Replace instanceof checks with other logic

This commit is contained in:
ahocevar
2018-10-05 16:16:51 +02:00
parent 96e99e481e
commit 9163558511
40 changed files with 232 additions and 268 deletions

View File

@@ -5,7 +5,6 @@ import {createOrUpdate} from '../extent.js';
import {transformWithOptions} from '../format/Feature.js';
import GMLBase, {GMLNS} from '../format/GMLBase.js';
import {writeStringTextNode} from '../format/xsd.js';
import Geometry from '../geom/Geometry.js';
import {assign} from '../obj.js';
import {get as getProjection, transformExtent} from '../proj.js';
import {createElementNS, getAllTextContent, makeArrayPusher, makeChildAppender,
@@ -196,7 +195,7 @@ class GML2 extends GMLBase {
if (value !== null) {
keys.push(key);
values.push(value);
if (key == geometryName || value instanceof Geometry) {
if (key == geometryName || typeof /** @type {?} */ (value).getSimplifiedGeometry === 'function') {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = makeChildAppender(
this.writeGeometryElement, this);