Use includes instead of indexOf
This commit is contained in:
@@ -167,7 +167,7 @@ class GMLBase extends XMLFeature {
|
||||
const child = /** @type {Element} */ (node.childNodes[i]);
|
||||
if (child.nodeType === 1) {
|
||||
const ft = child.nodeName.split(':').pop();
|
||||
if (featureType.indexOf(ft) === -1) {
|
||||
if (!featureType.includes(ft)) {
|
||||
let key = '';
|
||||
let count = 0;
|
||||
const uri = child.namespaceURI;
|
||||
@@ -206,10 +206,9 @@ class GMLBase extends XMLFeature {
|
||||
/** @type {Object<string, import("../xml.js").Parser>} */
|
||||
const parsers = {};
|
||||
for (let i = 0, ii = featureTypes.length; i < ii; ++i) {
|
||||
const featurePrefix =
|
||||
featureTypes[i].indexOf(':') === -1
|
||||
? defaultPrefix
|
||||
: featureTypes[i].split(':')[0];
|
||||
const featurePrefix = featureTypes[i].includes(':')
|
||||
? featureTypes[i].split(':')[0]
|
||||
: defaultPrefix;
|
||||
if (featurePrefix === p) {
|
||||
parsers[featureTypes[i].split(':').pop()] =
|
||||
localName == 'featureMembers'
|
||||
|
||||
@@ -262,7 +262,7 @@ class MVT extends FeatureFormat {
|
||||
const pbfLayers = pbf.readFields(layersPBFReader, {});
|
||||
const features = [];
|
||||
for (const name in pbfLayers) {
|
||||
if (layers && layers.indexOf(name) == -1) {
|
||||
if (layers && !layers.includes(name)) {
|
||||
continue;
|
||||
}
|
||||
const pbfLayer = pbfLayers[name];
|
||||
|
||||
@@ -110,7 +110,7 @@ class TopoJSON extends JSONFeature {
|
||||
const property = this.layerName_;
|
||||
let feature;
|
||||
for (const objectName in topoJSONFeatures) {
|
||||
if (this.layers_ && this.layers_.indexOf(objectName) == -1) {
|
||||
if (this.layers_ && !this.layers_.includes(objectName)) {
|
||||
continue;
|
||||
}
|
||||
if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
|
||||
|
||||
@@ -498,10 +498,10 @@ class WkbWriter {
|
||||
*/
|
||||
writeWkbHeader(wkbType, srid) {
|
||||
wkbType %= 1000; // Assume 1000 is an upper limit for type ID
|
||||
if (this.layout_.indexOf('Z') >= 0) {
|
||||
if (this.layout_.includes('Z')) {
|
||||
wkbType += this.isEWKB_ ? 0x80000000 : 1000;
|
||||
}
|
||||
if (this.layout_.indexOf('M') >= 0) {
|
||||
if (this.layout_.includes('M')) {
|
||||
wkbType += this.isEWKB_ ? 0x40000000 : 2000;
|
||||
}
|
||||
if (this.isEWKB_ && Number.isInteger(srid)) {
|
||||
|
||||
Reference in New Issue
Block a user