How to use the geojs.fileReader function in geojs

To help you get started, we’ve selected a few geojs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kitware / minerva / web_external / contourJsonReader.js View on Github external
geo.contourJsonReader = function (arg) {
    'use strict';
    if (!(this instanceof geo.contourJsonReader)) {
        return new geo.contourJsonReader(arg); // eslint-disable-line new-cap
    }

    var that = this;

    geo.fileReader.call(this, arg);

    this.canRead = function (file) {
        if (file instanceof File) {
            return (file.type === 'application/json' || file.name.match(/\.json$/));
        } else if (_.isString(file)) {
            try {
                JSON.parse(file);
            } catch (e) {
                return false;
            }
            return true;
        }
        try {
            if (Array.isArray(that._featureArray(file))) {
                return true;
            }