static async fromObject()

in testData.js [81:97]


    static async fromObject(obj, defaults) {
        var testData = null;
        if (obj.hasOwnProperty("url") && obj.url) {
            const response = await HTTP.getJSON(obj.url);
            testData = new TestData(response, {...defaults, ...obj});
        } else if (obj.hasOwnProperty("path") && obj.path) {
            const content = fs.readFileSync(obj.path);
            testData = new TestData(JSON.parse(content), {...defaults, ...obj});
        }
        else {
            testData = new TestData(obj, {});
        }
        var testDataProto = Object.getPrototypeOf(testData);
        testData = _.extend(_.pick(defaults, this.inheritedProperties()), testData);
        Object.setPrototypeOf(testData, testDataProto);
        return testData;
    }