Use Object.assign
This commit is contained in:
@@ -11,10 +11,10 @@ import MultiPolygon from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign, isEmpty} from '../obj.js';
|
||||
import {containsExtent} from '../extent.js';
|
||||
import {deflateCoordinates} from '../geom/flat/deflate.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import {isEmpty} from '../obj.js';
|
||||
import {linearRingIsClockwise} from '../geom/flat/orient.js';
|
||||
import {transformGeometryWithOptions} from './Feature.js';
|
||||
|
||||
@@ -274,10 +274,10 @@ function readGeometry(object, opt_options) {
|
||||
const rings = convertRings(esriJSONPolygon.rings, layout);
|
||||
if (rings.length === 1) {
|
||||
type = 'Polygon';
|
||||
object = assign({}, object, {['rings']: rings[0]});
|
||||
object = Object.assign({}, object, {['rings']: rings[0]});
|
||||
} else {
|
||||
type = 'MultiPolygon';
|
||||
object = assign({}, object, {['rings']: rings});
|
||||
object = Object.assign({}, object, {['rings']: rings});
|
||||
}
|
||||
}
|
||||
const geometryReader = GEOMETRY_READERS[type];
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import Units from '../proj/Units.js';
|
||||
import {abstract} from '../util.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {
|
||||
equivalent as equivalentProjection,
|
||||
get as getProjection,
|
||||
@@ -127,7 +126,7 @@ class FeatureFormat {
|
||||
* Updated options.
|
||||
*/
|
||||
adaptOptions(options) {
|
||||
return assign(
|
||||
return Object.assign(
|
||||
{
|
||||
dataProjection: this.dataProjection,
|
||||
featureProjection: this.defaultFeatureProjection,
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
pushParseAndPop,
|
||||
pushSerializeAndPop,
|
||||
} from '../xml.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createOrUpdate} from '../extent.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import {
|
||||
@@ -245,7 +244,7 @@ class GML2 extends GMLBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
const item = assign({}, context);
|
||||
const item = Object.assign({}, context);
|
||||
item.node = node;
|
||||
pushSerializeAndPop(
|
||||
/** @type {import("../xml.js").NodeStackItem} */
|
||||
@@ -330,7 +329,7 @@ class GML2 extends GMLBase {
|
||||
const context = /** @type {import("./Feature.js").WriteOptions} */ (
|
||||
objectStack[objectStack.length - 1]
|
||||
);
|
||||
const item = assign({}, context);
|
||||
const item = Object.assign({}, context);
|
||||
item['node'] = node;
|
||||
let value;
|
||||
if (Array.isArray(geometry)) {
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
pushParseAndPop,
|
||||
pushSerializeAndPop,
|
||||
} from '../xml.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {createOrUpdate} from '../extent.js';
|
||||
import {extend} from '../array.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
@@ -815,7 +814,7 @@ class GML3 extends GMLBase {
|
||||
const context = /** @type {import("./Feature.js").WriteOptions} */ (
|
||||
objectStack[objectStack.length - 1]
|
||||
);
|
||||
const item = assign({}, context);
|
||||
const item = Object.assign({}, context);
|
||||
item['node'] = node;
|
||||
let value;
|
||||
if (Array.isArray(geometry)) {
|
||||
@@ -888,7 +887,7 @@ class GML3 extends GMLBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
const item = assign({}, context);
|
||||
const item = Object.assign({}, context);
|
||||
item.node = node;
|
||||
pushSerializeAndPop(
|
||||
/** @type {import("../xml.js").NodeStackItem} */
|
||||
@@ -918,7 +917,7 @@ class GML3 extends GMLBase {
|
||||
this.writeFeatureElement,
|
||||
this
|
||||
);
|
||||
const item = assign({}, context);
|
||||
const item = Object.assign({}, context);
|
||||
item.node = node;
|
||||
pushSerializeAndPop(
|
||||
/** @type {import("../xml.js").NodeStackItem} */
|
||||
@@ -1001,7 +1000,7 @@ class GML3 extends GMLBase {
|
||||
multiCurve: this.multiCurve_,
|
||||
};
|
||||
if (opt_options) {
|
||||
assign(context, opt_options);
|
||||
Object.assign(context, opt_options);
|
||||
}
|
||||
this.writeGeometryElement(geom, geometry, [context]);
|
||||
return geom;
|
||||
@@ -1034,7 +1033,7 @@ class GML3 extends GMLBase {
|
||||
featureType: this.featureType,
|
||||
};
|
||||
if (opt_options) {
|
||||
assign(context, opt_options);
|
||||
Object.assign(context, opt_options);
|
||||
}
|
||||
this.writeFeatureMembers_(node, features, [context]);
|
||||
return node;
|
||||
|
||||
@@ -13,7 +13,6 @@ import MultiPolygon from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import XMLFeature from './XMLFeature.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {extend} from '../array.js';
|
||||
import {
|
||||
getAllTextContent,
|
||||
@@ -570,7 +569,7 @@ class GMLBase extends XMLFeature {
|
||||
featureNS: this.featureNS,
|
||||
};
|
||||
if (opt_options) {
|
||||
assign(options, this.getReadOptions(node, opt_options));
|
||||
Object.assign(options, this.getReadOptions(node, opt_options));
|
||||
}
|
||||
const features = this.readFeaturesInternal(node, [options]);
|
||||
return features || [];
|
||||
|
||||
@@ -12,8 +12,8 @@ import MultiPolygon from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign, isEmpty} from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import {isEmpty} from '../obj.js';
|
||||
import {transformGeometryWithOptions} from './Feature.js';
|
||||
|
||||
/**
|
||||
@@ -476,7 +476,7 @@ function writeGeometry(geometry, opt_options) {
|
||||
*/
|
||||
function writeGeometryCollectionGeometry(geometry, opt_options) {
|
||||
const geometries = geometry.getGeometriesArray().map(function (geometry) {
|
||||
const options = assign({}, opt_options);
|
||||
const options = Object.assign({}, opt_options);
|
||||
delete options.featureProjection;
|
||||
return writeGeometry(geometry, options);
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
} from '../xml.js';
|
||||
import {and as andFilterFn, bbox as bboxFilterFn} from './filter.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import {
|
||||
readNonNegativeIntegerString,
|
||||
@@ -333,12 +332,15 @@ class WFS extends XMLFeature {
|
||||
const context = {
|
||||
node,
|
||||
};
|
||||
assign(context, {
|
||||
Object.assign(context, {
|
||||
'featureType': this.featureType_,
|
||||
'featureNS': this.featureNS_,
|
||||
});
|
||||
|
||||
assign(context, this.getReadOptions(node, opt_options ? opt_options : {}));
|
||||
Object.assign(
|
||||
context,
|
||||
this.getReadOptions(node, opt_options ? opt_options : {})
|
||||
);
|
||||
const objectStack = [context];
|
||||
let featuresNS;
|
||||
if (this.version_ === '2.0.0') {
|
||||
@@ -511,7 +513,7 @@ class WFS extends XMLFeature {
|
||||
const context = {
|
||||
node,
|
||||
};
|
||||
assign(context, {
|
||||
Object.assign(context, {
|
||||
'version': this.version_,
|
||||
'srsName': options.srsName,
|
||||
'featureNS': options.featureNS ? options.featureNS : this.featureNS_,
|
||||
@@ -530,7 +532,7 @@ class WFS extends XMLFeature {
|
||||
filter
|
||||
);
|
||||
}
|
||||
assign(context, {
|
||||
Object.assign(context, {
|
||||
'geometryName': options.geometryName,
|
||||
'filter': filter,
|
||||
});
|
||||
@@ -548,7 +550,7 @@ class WFS extends XMLFeature {
|
||||
options.srsName,
|
||||
options.filter
|
||||
);
|
||||
assign(context, {
|
||||
Object.assign(context, {
|
||||
'geometryName': featureType.geometryName,
|
||||
'filter': completeFilter,
|
||||
});
|
||||
@@ -686,7 +688,7 @@ function createTransactionRequest(node, baseObj, version, options) {
|
||||
} else if (version === '2.0.0') {
|
||||
gmlVersion = 3.2;
|
||||
}
|
||||
const obj = assign(
|
||||
const obj = Object.assign(
|
||||
{node},
|
||||
{
|
||||
version,
|
||||
@@ -1035,7 +1037,7 @@ function writeQuery(node, featureType, objectStack) {
|
||||
node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);
|
||||
}
|
||||
const item = /** @type {import("../xml.js").NodeStackItem} */ (
|
||||
assign({}, context)
|
||||
Object.assign({}, context)
|
||||
);
|
||||
item.node = node;
|
||||
pushSerializeAndPop(
|
||||
@@ -1062,7 +1064,7 @@ function writeFilterCondition(node, filter, objectStack) {
|
||||
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
/** @type {import("../xml.js").NodeStackItem} */
|
||||
const item = {node};
|
||||
assign(item, {context});
|
||||
Object.assign(item, {context});
|
||||
pushSerializeAndPop(
|
||||
item,
|
||||
GETFEATURE_SERIALIZERS,
|
||||
@@ -1167,7 +1169,7 @@ function writeLogicalFilter(node, filter, objectStack) {
|
||||
const context = parent['context'];
|
||||
/** @type {import("../xml.js").NodeStackItem} */
|
||||
const item = {node};
|
||||
assign(item, {context});
|
||||
Object.assign(item, {context});
|
||||
const conditions = filter.conditions;
|
||||
for (let i = 0, ii = conditions.length; i < ii; ++i) {
|
||||
const condition = conditions[i];
|
||||
@@ -1191,7 +1193,7 @@ function writeNotFilter(node, filter, objectStack) {
|
||||
const context = parent['context'];
|
||||
/** @type {import("../xml.js").NodeStackItem} */
|
||||
const item = {node};
|
||||
assign(item, {context});
|
||||
Object.assign(item, {context});
|
||||
const condition = filter.condition;
|
||||
pushSerializeAndPop(
|
||||
item,
|
||||
@@ -1332,7 +1334,7 @@ export function writeFilter(filter, opt_version) {
|
||||
const context = {
|
||||
node: child,
|
||||
};
|
||||
assign(context, {
|
||||
Object.assign(context, {
|
||||
'version': version,
|
||||
'filter': filter,
|
||||
});
|
||||
@@ -1348,7 +1350,7 @@ export function writeFilter(filter, opt_version) {
|
||||
function writeGetFeature(node, featureTypes, objectStack) {
|
||||
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const item = /** @type {import("../xml.js").NodeStackItem} */ (
|
||||
assign({}, context)
|
||||
Object.assign({}, context)
|
||||
);
|
||||
item.node = node;
|
||||
pushSerializeAndPop(
|
||||
|
||||
@@ -13,7 +13,6 @@ import Polygon from '../geom/Polygon.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
import SimpleGeometry from '../geom/SimpleGeometry.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
// WKB spec: https://www.ogc.org/standards/sfa
|
||||
// EWKB spec: https://raw.githubusercontent.com/postgis/postgis/2.1.0/doc/ZMSgeoms.txt
|
||||
@@ -423,7 +422,7 @@ class WkbWriter {
|
||||
* @property {number} Z NoData value for Z
|
||||
* @property {number} M NoData value for M
|
||||
*/
|
||||
this.nodata_ = assign({X: 0, Y: 0, Z: 0, M: 0}, opts.nodata);
|
||||
this.nodata_ = Object.assign({X: 0, Y: 0, Z: 0, M: 0}, opts.nodata);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,7 +458,7 @@ class WkbWriter {
|
||||
* @property {number} [Z] NoData value for Z
|
||||
* @property {number} [M] NoData value for M
|
||||
*/
|
||||
const coordsObj = assign.apply(
|
||||
const coordsObj = Object.assign.apply(
|
||||
null,
|
||||
layout.split('').map((axis, idx) => ({[axis]: coords[idx]}))
|
||||
);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import GML2 from './GML2.js';
|
||||
import XMLFeature from './XMLFeature.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {extend} from '../array.js';
|
||||
import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';
|
||||
|
||||
@@ -157,7 +156,7 @@ class WMSGetFeatureInfo extends XMLFeature {
|
||||
readFeaturesFromNode(node, opt_options) {
|
||||
const options = {};
|
||||
if (opt_options) {
|
||||
assign(options, this.getReadOptions(node, opt_options));
|
||||
Object.assign(options, this.getReadOptions(node, opt_options));
|
||||
}
|
||||
return this.readFeatures_(node, [options]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user