<commit_before>'use strict';

const Utils = require("../../util/utils");

module.exports = class FeatureList {

    constructor() {
        this.features = []
    }

    add(properties, geometry) {
        let feature = {
            type: "Feature",
            geometry: Utils.sortObject(geometry),
            properties: Utils.sortObject(properties)
        };

        this.features.push(feature);
    }

    getFeatures() {
        return this.features;
    }

    getFeatureCollection() {
        return {
            type: "FeatureCollection",
            features: this.features,
        };
    }

    static createFromArray(array) {
        if (!array.hasOwnProperty("features")) {
            throw("Supplied JSON does not contain required property 'features'");
        }

        let instance = new FeatureList();
        let features = array.features;

        for (let i in features) {
            instance.add(features[i].properties, features[i].geometry)
        }

        return instance;
    }
};<commit_msg>Put data into alphabetical order<commit_after>'use strict';

const Utils = require("../../util/utils");

module.exports = class FeatureList {

    constructor() {
        this.features = []
    }

    add(properties, geometry) {
        let feature = {
            geometry: Utils.sortObject(geometry),
            properties: Utils.sortObject(properties),
            type: "Feature"
        };

        this.features.push(feature);
    }

    getFeatures() {
        return this.features;
    }

    getFeatureCollection() {
        return {
            type: "FeatureCollection",
            features: this.features,
        };
    }

    static createFromArray(array) {
        if (!array.hasOwnProperty("features")) {
            throw("Supplied JSON does not contain required property 'features'");
        }

        let instance = new FeatureList();
        let features = array.features;

        for (let i in features) {
            instance.add(features[i].properties, features[i].geometry)
        }

        return instance;
    }
};
{'fraction_non_alphanumeric': 0.11759036144578314, 'fraction_numerical': 0.0, 'mean_word_length': 1.9363507779349363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1182990', 'n_tokens_mistral': 545, 'n_tokens_neox': 527, 'n_words': 120}