nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 99e703a91a0c6d0bdd9347c2a440ecb5023bf9fc
parent 1736211ba82f1d4117a4bd8a7ad2a2b870f498ae
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sun,  5 Jan 2020 21:44:22 +0100

fix lint errors (require-unicode-regexp)

Diffstat:
Mscripts/build.js | 4++--
Msrc/index.js | 2+-
Msrc/lib/CORSProxy/index.js | 2+-
Msrc/lib/iconFromBackgroundImage/index.js | 2+-
Msrc/lib/leaflet.control.jnx/index.js | 2+-
Msrc/lib/leaflet.control.jnx/jnx-maker.js | 2+-
Msrc/lib/leaflet.control.layers.configure/index.js | 10+++++-----
Msrc/lib/leaflet.control.panoramas/lib/wikimedia/index.js | 10+++++-----
Msrc/lib/leaflet.control.track-list/lib/parsers/gpx.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/parsers/kml.js | 6+++---
Msrc/lib/leaflet.control.track-list/lib/parsers/urlSafeBase64.js | 10+++++-----
Msrc/lib/leaflet.control.track-list/lib/parsers/zip.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/baseService.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/endomondo.js | 4++--
Msrc/lib/leaflet.control.track-list/lib/services/etomesto.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/gpsies.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/gpslib.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/movescount.js | 4++--
Msrc/lib/leaflet.control.track-list/lib/services/osm.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/sportstracker.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/strava.js | 6+++---
Msrc/lib/leaflet.control.track-list/lib/services/tracedetrail.js | 2+-
Msrc/lib/leaflet.control.track-list/lib/services/yandex.js | 4++--
Msrc/lib/leaflet.control.track-list/track-list.js | 4++--
Msrc/lib/leaflet.control.track-list/track-list.localstorage.js | 6+++---
Msrc/lib/leaflet.hashState/hashState.js | 2+-
Msrc/lib/leaflet.layer.soviet-topomaps-grid/index.js | 6+++---
Msrc/lib/leaflet.layer.wikimapia/wm-utils.js | 8++++----
Mwebpack/webpack.config.js | 24++++++++++++------------
29 files changed, 68 insertions(+), 68 deletions(-)

diff --git a/scripts/build.js b/scripts/build.js @@ -19,14 +19,14 @@ function getVersionFromGit() { // Output: /static/js/main.js function removeFileNameHash(fileName) { return fileName - .replace(/\/?(.*)(\.[0-9a-f]+)(\.js|\.css)/, (match, p1, p2, p3) => p1 + p3); + .replace(/\/?(.*)(\.[0-9a-f]+)(\.js|\.css)/u, (match, p1, p2, p3) => p1 + p3); } function getSizes(removeNameHash) { return new Promise((resolve) => { recursive(paths.appBuild, (err, fileNames) => { const previousSizeMap = (fileNames || []) - .filter(fileName => /\.(js|css)$/.test(fileName)) + .filter(fileName => /\.(js|css)$/u.test(fileName)) .reduce((memo, fileName) => { const contents = fs.readFileSync(fileName); const relativeFileName = fileName.replace(paths.appBuild + '/', ''); diff --git a/src/index.js b/src/index.js @@ -5,7 +5,7 @@ import config from './config'; function getUid() { const cookie = document.cookie; - const cookieUid = cookie.match(/\buid=([^;]+)/)[1]; + const cookieUid = cookie.match(/\buid=([^;]+)/u)[1]; const uidRaw = atob(cookieUid); const l = []; for (let i = 0; i < uidRaw.length; i++) { diff --git a/src/lib/CORSProxy/index.js b/src/lib/CORSProxy/index.js @@ -1,5 +1,5 @@ import config from '~/config'; export default function urlViaCorsProxy(url) { - return config.CORSProxyUrl + url.replace(/^(https?):\/\//, '$1/'); + return config.CORSProxyUrl + url.replace(/^(https?):\/\//u, '$1/'); } diff --git a/src/lib/iconFromBackgroundImage/index.js b/src/lib/iconFromBackgroundImage/index.js @@ -16,7 +16,7 @@ function iconFromBackgroundImage(className) { el.className = className; container.appendChild(el); const st = window.getComputedStyle(el), - url = st.backgroundImage.replace(/^url\("?/, '').replace(/"?\)$/, ''); + url = st.backgroundImage.replace(/^url\("?/u, '').replace(/"?\)$/u, ''); let icon = {'url': url, 'center': [-el.offsetLeft, -el.offsetTop]}; document.body.removeChild(container); container.removeChild(el); diff --git a/src/lib/leaflet.control.jnx/index.js b/src/lib/leaflet.control.jnx/index.js @@ -87,7 +87,7 @@ L.Control.JNX = L.Control.extend({ this.downloadProgressDone(0); const bounds = this._selector.getBounds(); - const sanitizedLayerName = layerName.toLowerCase().replace(/[ ()]+/, '_'); + const sanitizedLayerName = layerName.toLowerCase().replace(/[ ()]+/u, '_'); const fileName = `nakarte.me_${sanitizedLayerName}_z${zoom}.jnx`; const eventId = logging.randId(); logging.logEvent('jnx start', {eventId, layerName, zoom, bounds}); diff --git a/src/lib/leaflet.control.jnx/jnx-maker.js b/src/lib/leaflet.control.jnx/jnx-maker.js @@ -37,7 +37,7 @@ async function convertToJpeg(image) { const ctx = canvas.getContext("2d"); ctx.drawImage(image, 0, 0); const dataURL = canvas.toDataURL("image/jpeg"); - const s = atob(dataURL.replace(/^data:image\/jpeg;base64,/, "")); + const s = atob(dataURL.replace(/^data:image\/jpeg;base64,/u, "")); return stringToArrayBuffer(s); } diff --git a/src/lib/leaflet.control.layers.configure/index.js b/src/lib/leaflet.control.layers.configure/index.js @@ -327,7 +327,7 @@ function enableConfig(control, {layers, customLayersOrder}) { serializeCustomLayer: function(fieldValues) { let s = JSON.stringify(fieldValues); - s = s.replace(/[\u007f-\uffff]/g, + s = s.replace(/[\u007f-\uffff]/ug, function(c) { return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); } @@ -335,8 +335,8 @@ function enableConfig(control, {layers, customLayersOrder}) { function encodeUrlSafeBase64(s) { return btoa(s) - .replace(/\+/g, '-') - .replace(/\//g, '_'); + .replace(/\+/ug, '-') + .replace(/\//ug, '_'); } return '-cs' + encodeUrlSafeBase64(s); @@ -477,9 +477,9 @@ function enableConfig(control, {layers, customLayersOrder}) { loadCustomLayerFromString: function(s) { let fieldValues; - const m = s.match(/^-cs(.+)$/); + const m = s.match(/^-cs(.+)$/u); if (m) { - s = m[1].replace(/-/g, '+').replace(/_/g, '/'); + s = m[1].replace(/-/ug, '+').replace(/_/ug, '/'); try { s = atob(s); fieldValues = JSON.parse(s); diff --git a/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js b/src/lib/leaflet.control.panoramas/lib/wikimedia/index.js @@ -27,12 +27,12 @@ function parseSearchResponse(resp) { // eslint-disable-line complexity const iinfo = page.imageinfo[0]; let imageDescription = iinfo.extmetadata.ImageDescription ? iinfo.extmetadata.ImageDescription.value : null; let objectDescription = iinfo.extmetadata.ObjectName ? iinfo.extmetadata.ObjectName.value : null; - if (imageDescription && /^<table (.|\n)+<\/table>$/.test(imageDescription)) { + if (imageDescription && /^<table (.|\n)+<\/table>$/u.test(imageDescription)) { imageDescription = null; } if (imageDescription) { - imageDescription = imageDescription.replace(/<[^>]+>/g, ''); - imageDescription = imageDescription.replace(/[\n\r]/g, ''); + imageDescription = imageDescription.replace(/<[^>]+>/ug, ''); + imageDescription = imageDescription.replace(/[\n\r]/ug, ''); } if (imageDescription && objectDescription && objectDescription.toLowerCase().includes(imageDescription.toLowerCase())) { imageDescription = null; @@ -55,7 +55,7 @@ function parseSearchResponse(resp) { // eslint-disable-line complexity } let author = iinfo.extmetadata.Artist ? iinfo.extmetadata.Artist.value : null; - if (author && /^<table (.|\n)+<\/table>$/.test(author)) { + if (author && /^<table (.|\n)+<\/table>$/u.test(author)) { author = `See author info at <a href="${iinfo.descriptionurl}">Wikimedia commons</a>`; } @@ -133,7 +133,7 @@ async function getPanoramaAtPos(latlng, searchRadiusMeters) { } function formatDateTime(dateStr) { - const m = /^(\d+)-(\d+)-(\d+)/.exec(dateStr); + const m = /^(\d+)-(\d+)-(\d+)/u.exec(dateStr); const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; if (m) { let [year, month, day] = m.slice(1); diff --git a/src/lib/leaflet.control.track-list/lib/parsers/gpx.js b/src/lib/leaflet.control.track-list/lib/parsers/gpx.js @@ -89,7 +89,7 @@ function parseGpx(txt, name, preferNameFromFile) { txt = stripBom(txt); // remove namespaces - txt = txt.replace(/<([^ >]+):([^ >]+)/g, '<$1_$2'); + txt = txt.replace(/<([^ >]+):([^ >]+)/ug, '<$1_$2'); let dom; try { dom = (new DOMParser()).parseFromString(txt, "text/xml"); diff --git a/src/lib/leaflet.control.track-list/lib/parsers/kml.js b/src/lib/leaflet.control.track-list/lib/parsers/kml.js @@ -9,7 +9,7 @@ function parseKml(txt, name) { var getSegmentPoints = function(coordinates_element) { // convert multiline text value of tag to single line var coordinates_string = xmlGetNodeText(coordinates_element); - var points_strings = coordinates_string.split(/\s+/); + var points_strings = coordinates_string.split(/\s+/u); var points = []; for (var i = 0; i < points_strings.length; i++) { if (points_strings[i].length) { @@ -88,7 +88,7 @@ function parseKml(txt, name) { } txt = stripBom(txt); - txt = txt.replace(/<([^ >]+):([^ >]+)/g, '<$1_$2'); + txt = txt.replace(/<([^ >]+):([^ >]+)/ug, '<$1_$2'); let dom; try { dom = (new DOMParser()).parseFromString(txt, "text/xml"); @@ -140,7 +140,7 @@ function parseKmz(txt, name) { for (i = 0; i < unzipper.entries.length; i++) { entry = unzipper.entries[i]; - if (entry.fileName.match(/\.kml$/i)) { + if (entry.fileName.match(/\.kml$/iu)) { if (entry.compressionMethod === 0) { uncompressed = entry.data; } else if (entry.compressionMethod === 8) { diff --git a/src/lib/leaflet.control.track-list/lib/parsers/urlSafeBase64.js b/src/lib/leaflet.control.track-list/lib/parsers/urlSafeBase64.js @@ -1,7 +1,7 @@ function encode(s) { return (btoa(s) - .replace(/\+/g, '-') - .replace(/\//g, '_') + .replace(/\+/ug, '-') + .replace(/\//ug, '_') // .replace(/=+$/, '') ); } @@ -9,9 +9,9 @@ function encode(s) { function decode(s) { var decoded; s = s - .replace(/[\n\r \t]/g, '') - .replace(/-/g, '+') - .replace(/_/g, '/'); + .replace(/[\n\r \t]/ug, '') + .replace(/-/ug, '+') + .replace(/_/ug, '/'); try { decoded = atob(s); } catch (e) { diff --git a/src/lib/leaflet.control.track-list/lib/parsers/zip.js b/src/lib/leaflet.control.track-list/lib/parsers/zip.js @@ -32,7 +32,7 @@ function parseZip(txt, _unused_name) { var file_name = decode866(entry.fileName); var geodata = parseGeoFile(file_name, uncompressed); for (let item of geodata) { - if (item.error === 'UNSUPPORTED' && item.name.match(/\.pdf$|\.doc$|\.txt$\.jpg$/)) { + if (item.error === 'UNSUPPORTED' && item.name.match(/\.pdf$|\.doc$|\.txt$\.jpg$/u)) { continue; } geodata_array.push(item); diff --git a/src/lib/leaflet.control.track-list/lib/services/baseService.js b/src/lib/leaflet.control.track-list/lib/services/baseService.js @@ -42,7 +42,7 @@ class BaseService { return url .split('#')[0] .split('?')[0] - .replace(/\/*$/, '') + .replace(/\/*$/u, '') .split('/') .pop(); } diff --git a/src/lib/leaflet.control.track-list/lib/services/endomondo.js b/src/lib/leaflet.control.track-list/lib/services/endomondo.js @@ -3,8 +3,8 @@ import urlViaCorsProxy from '~/lib/CORSProxy'; class Endomondo extends BaseService { urlRegexps = [ - /^https:\/\/www\.endomondo\.com\/users\/(\d+)\/workouts\/(\d+)/, - /^https:\/\/www\.endomondo\.com\/workouts\/(\d+)\/(\d+)/ + /^https:\/\/www\.endomondo\.com\/users\/(\d+)\/workouts\/(\d+)/u, + /^https:\/\/www\.endomondo\.com\/workouts\/(\d+)\/(\d+)/u ]; isOurUrl() { diff --git a/src/lib/leaflet.control.track-list/lib/services/etomesto.js b/src/lib/leaflet.control.track-list/lib/services/etomesto.js @@ -3,7 +3,7 @@ import BaseService from './baseService'; import parseGpx from '../parsers/gpx'; class Etomesto extends BaseService { - urlRe = /^https?:\/\/www\.etomesto\.ru\/track([a-z0-9]+)/; + urlRe = /^https?:\/\/www\.etomesto\.ru\/track([a-z0-9]+)/u; getTrackId() { const m = this.urlRe.exec(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/gpsies.js b/src/lib/leaflet.control.track-list/lib/services/gpsies.js @@ -4,7 +4,7 @@ import parseGpx from '../parsers/gpx'; import urlEncode from './urlEncode'; class Gpsies extends BaseService { - urlRe = /^https?:\/\/www\.gpsies\.com\/map\.do[^?]*\?fileId=([a-z]+)/; + urlRe = /^https?:\/\/www\.gpsies\.com\/map\.do[^?]*\?fileId=([a-z]+)/u; isOurUrl() { return this.urlRe.test(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/gpslib.js b/src/lib/leaflet.control.track-list/lib/services/gpslib.js @@ -3,7 +3,7 @@ import BaseService from './baseService'; import parseGpx from '../parsers/gpx'; class Gpslib extends BaseService { - urlRe = /^https?:\/\/(?:.+\.)?gpslib\.[^.]+\/tracks\/info\/(\d+)/; + urlRe = /^https?:\/\/(?:.+\.)?gpslib\.[^.]+\/tracks\/info\/(\d+)/u; isOurUrl() { return this.urlRe.test(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/movescount.js b/src/lib/leaflet.control.track-list/lib/services/movescount.js @@ -8,7 +8,7 @@ class MovescountBase extends BaseService { } class MovescountRoute extends MovescountBase { - urlRe = /^https?:\/\/www.movescount.com\/([a-z]{2}\/)?map.*[?&]route=(\d+)/; + urlRe = /^https?:\/\/www.movescount.com\/([a-z]{2}\/)?map.*[?&]route=(\d+)/u; requestOptions() { const m = this.urlRe.exec(this.origUrl); @@ -59,7 +59,7 @@ class MovescountRoute extends MovescountBase { } class MovescountMove extends MovescountBase { - urlRe = /^https?:\/\/www.movescount.com\/([a-z]{2}\/)?moves\/move(\d+)/; + urlRe = /^https?:\/\/www.movescount.com\/([a-z]{2}\/)?moves\/move(\d+)/u; requestOptions() { const m = this.urlRe.exec(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/osm.js b/src/lib/leaflet.control.track-list/lib/services/osm.js @@ -3,7 +3,7 @@ import BaseService from './baseService'; import parseGpx from '../parsers/gpx'; class Osm extends BaseService { - urlRe = /^https?:\/\/www\.openstreetmap\.org\/user\/(?:.*)\/traces\/(\d+)/; + urlRe = /^https?:\/\/www\.openstreetmap\.org\/user\/(?:.*)\/traces\/(\d+)/u; getTrackId() { const m = this.urlRe.exec(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/sportstracker.js b/src/lib/leaflet.control.track-list/lib/services/sportstracker.js @@ -9,7 +9,7 @@ class SportsTrackerBase extends BaseService { } class SportsTrackerActivity extends SportsTrackerBase { - urlRe = /^https?:\/\/(www.)?sports-tracker.com\/workout\/([^/]+)\/([a-z0-9]+)/; + urlRe = /^https?:\/\/(www.)?sports-tracker.com\/workout\/([^/]+)\/([a-z0-9]+)/u; requestOptions() { const m = this.urlRe.exec(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/strava.js b/src/lib/leaflet.control.track-list/lib/services/strava.js @@ -3,7 +3,7 @@ import urlViaCorsProxy from '~/lib/CORSProxy'; import {decode as utf8_decode} from 'utf8'; class Strava extends BaseService { - urlRe = /^https?:\/\/(?:.+\.)?strava\.com\/activities\/(\d+)/; + urlRe = /^https?:\/\/(?:.+\.)?strava\.com\/activities\/(\d+)/u; isOurUrl() { return this.urlRe.test(this.origUrl); @@ -52,12 +52,12 @@ class Strava extends BaseService { let title = dom.querySelector('meta[property=og\\:title]').content; title = utf8_decode(title); // name and description - const m = title.match(/^(.+) - ([^-]+)/); + const m = title.match(/^(.+) - ([^-]+)/u); if (m) { // reverse name and description name2 = `${m[2]} ${m[1]}`; title = dom.querySelector('title').text; - let date = title.match(/ (on \d{1,2} \w+ \d{4}) /)[1]; + let date = title.match(/ (on \d{1,2} \w+ \d{4}) /u)[1]; if (date) { name2 += ' ' + date; } diff --git a/src/lib/leaflet.control.track-list/lib/services/tracedetrail.js b/src/lib/leaflet.control.track-list/lib/services/tracedetrail.js @@ -3,7 +3,7 @@ import urlViaCorsProxy from '~/lib/CORSProxy'; import L from 'leaflet'; class Tracedetrail extends BaseService { - urlRe = /^https?:\/\/tracedetrail\.[a-z]{2,}(\/index\.php)?\/[a-z]{2}\/trace\/trace\/([0-9]+)/; + urlRe = /^https?:\/\/tracedetrail\.[a-z]{2,}(\/index\.php)?\/[a-z]{2}\/trace\/trace\/([0-9]+)/u; isOurUrl() { return this.urlRe.test(this.origUrl); diff --git a/src/lib/leaflet.control.track-list/lib/services/yandex.js b/src/lib/leaflet.control.track-list/lib/services/yandex.js @@ -1,7 +1,7 @@ import BaseService from './baseService'; class YandexRuler extends BaseService { - urlRe = /yandex\..+[?&]rl=([^&]+)/; + urlRe = /yandex\..+[?&]rl=([^&]+)/u; isOurUrl() { return this.urlRe.test(this.origUrl); @@ -17,7 +17,7 @@ class YandexRuler extends BaseService { let error; const points = []; let s = this.urlRe.exec(this.origUrl)[1]; - s = s.replace(/%2C/ig, ','); + s = s.replace(/%2C/iug, ','); const points_str = s.split('~'); for (let i = 0; i < points_str.length; i++) { let point = points_str[i].split(','); diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js @@ -508,7 +508,7 @@ L.Control.TrackList = L.Control.extend({ } let serialized = tracks.map((track) => this.trackToString(track)).join('/'); const hashDigest = md5(serialized, null, true); - const key = btoa(hashDigest).replace(/\//g, '_').replace(/\+/g, '-').replace(/=/g, ''); + const key = btoa(hashDigest).replace(/\//ug, '_').replace(/\+/ug, '-').replace(/=/ug, ''); const url = window.location + '&nktl=' + key; copyToClipboard(url, mouseEvent); fetch(`${config.tracksStorageServer}/track/${key}`, {method: 'POST', data: serialized}).then( @@ -1008,7 +1008,7 @@ L.Control.TrackList = L.Control.extend({ }, setMarkerLabel: function(marker, label) { - if (label.match(/^\d{3,}/)) { + if (label.match(/^\d{3,}/u)) { var n = parseInt(label, 10); marker._parentTrack._pointAutoInc = Math.max(n, marker._parentTrack._pointAutoInc | 0); diff --git a/src/lib/leaflet.control.track-list/track-list.localstorage.js b/src/lib/leaflet.control.track-list/track-list.localstorage.js @@ -15,7 +15,7 @@ L.Control.TrackList.include({ for (i = 0; i < safeLocalStorage.length; i++) { key = safeLocalStorage.key(i); - m = key.match(/^trackList_(\d+)$/); + m = key.match(/^trackList_(\d+)$/u); if (m && m[1] !== undefined) { if (Number(m[1]) > maxKey) { maxKey = Number(m[1]); @@ -43,7 +43,7 @@ L.Control.TrackList.include({ //cleanup stale records for (i = 0; i < safeLocalStorage.length; i++) { key = safeLocalStorage.key(i); - m = key.match(/^trackList_(\d+)$/); + m = key.match(/^trackList_(\d+)$/u); if (m && m[1] !== undefined) { keys.push(Number(m[1])); } @@ -67,7 +67,7 @@ L.Control.TrackList.include({ for (i = 0; i < safeLocalStorage.length; i++) { key = safeLocalStorage.key(i); - m = key.match(/^trackList_(\d+)$/); + m = key.match(/^trackList_(\d+)$/u); if (m && m[1] !== undefined) { if (Number(m[1]) > maxKey) { maxKey = Number(m[1]); diff --git a/src/lib/leaflet.hashState/hashState.js b/src/lib/leaflet.hashState/hashState.js @@ -18,7 +18,7 @@ function parseHashParams(s) { s = s.substr(i + 1).trim(); let m, key, value; for (let pair of s.split('&')) { - m = /^([^=]+?)(?:=(.*))?$/.exec(pair); + m = /^([^=]+?)(?:=(.*))?$/u.exec(pair); if (m) { [, key, value] = m; if (value) { diff --git a/src/lib/leaflet.layer.soviet-topomaps-grid/index.js b/src/lib/leaflet.layer.soviet-topomaps-grid/index.js @@ -55,7 +55,7 @@ var Nomenclature = { } const names = [name1 + name2]; for (let replacer of bigLetterReplacers) { - let name3 = name2.replace(/\b[1-4]\b/g, (s) => { + let name3 = name2.replace(/\b[1-4]\b/gu, (s) => { return replacer[s]; } ); @@ -93,7 +93,7 @@ var Nomenclature = { } const names = [name1 + name2]; for (let replacer of bigLetterReplacers) { - let name3 = name2.replace(/\b[1-4]\b/g, (s) => { + let name3 = name2.replace(/\b[1-4]\b/gu, (s) => { return replacer[s]; } ); @@ -202,7 +202,7 @@ L.Layer.SovietTopoGrid = L.LayerGroup.extend({ rect.bringToBack(); } var objects = [rect]; - const title = titles[0].replace(/-/g, ' &ndash; '); + const title = titles[0].replace(/-/gu, ' &ndash; '); var html = L.Util.template(`<span style="color:{color}">{title}</span>`, {color: color, title: title}); var icon = L.divIcon({html: html, className: 'leaflet-sovietgrid-quadtitle-' + layer, iconSize: null}); var marker = L.marker(L.latLngBounds(bounds).getCenter(), {icon: icon}); diff --git a/src/lib/leaflet.layer.wikimapia/wm-utils.js b/src/lib/leaflet.layer.wikimapia/wm-utils.js @@ -17,7 +17,7 @@ function getTileId({x, y, z}) { function makeTileUrl(coords) { const tileId = getTileId(coords), - urlPath = tileId.replace(/(\d{3})(?!$)/g, '$1/'); // "033331022" -> "033/331/022" + urlPath = tileId.replace(/(\d{3})(?!$)/gu, '$1/'); // "033331022" -> "033/331/022" return `http://wikimapia.org/z1/itiles/${urlPath}.xy?342342`; } @@ -155,7 +155,7 @@ async function parseTile(s, projectObj) { } const fields = lines[0].split('|'); const tileId = fields[0]; - if (!tileId || !tileId.match(/^[0-3]+$/)) { + if (!tileId || !tileId.match(/^[0-3]+$/u)) { throw new Error('Invalid tile header'); } tile.tileId = tileId; @@ -176,7 +176,7 @@ async function parseTile(s, projectObj) { continue; } let placeId = fields[0]; - if (!placeId.match(/^\d+$/)) { + if (!placeId.match(/^\d+$/u)) { // throw new Error('Invalid place id'); continue; } @@ -186,7 +186,7 @@ async function parseTile(s, projectObj) { throw new Error(`Unknown wikimapia polygon encoding type: "${fields[6]}"`); } - let bounds = fields[2].match(/^([-\d]+),([-\d]+),([-\d]+),([-\d]+)$/); + let bounds = fields[2].match(/^([-\d]+),([-\d]+),([-\d]+),([-\d]+)$/u); if (!bounds) { throw new Error('Invalid place bounds'); } diff --git a/webpack/webpack.config.js b/webpack/webpack.config.js @@ -60,7 +60,7 @@ const babelConfig = { const sourceMapOption = { filename: '[file].map', columns: isProduction, - exclude: /mapillary/ + exclude: /mapillary/u }; const devToolPlugin = isProduction ? Webpack.SourceMapDevToolPlugin : Webpack.EvalSourceMapDevToolPlugin; @@ -116,12 +116,12 @@ const developmentCSSLoader = [ const loaders = [ { - test: /\.mjs$/, - include: /node_modules/, + test: /\.mjs$/u, + include: /node_modules/u, type: 'javascript/auto' }, { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, + test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/u, use: { loader: 'url-loader', options: { @@ -131,12 +131,12 @@ const loaders = [ } }, { - test: /\.(html)(\?.*)?$/, + test: /\.(html)(\?.*)?$/u, loader: 'raw-loader' }, ...((isProduction || isDevelopment) ? [{ - test: /\.js$/, + test: /\.js$/u, include: paths.appSrc, enforce: 'pre', loader: 'eslint-loader', @@ -146,11 +146,11 @@ const loaders = [ }] : []), { - test: /\.js$/, + test: /\.js$/u, exclude: isProduction ? [ - /node_modules\/core-js/, - /node_modules\/webpack/, - ] : /node_modules/, + /node_modules\/core-js/u, + /node_modules\/webpack/u, + ] : /node_modules/u, loaders: [ { loader: 'babel-loader', @@ -160,7 +160,7 @@ const loaders = [ }, { - test: /\.s?css/i, + test: /\.s?css/iu, loaders : isProduction ? productionCSSLoader : developmentCSSLoader } ]; @@ -185,7 +185,7 @@ module.exports = { cache: true, parallel: true, sourceMap: true, - exclude: /mapillary/ + exclude: /mapillary/u })], },