Grammalecte  Check-in [7ab6e5b571]

Overview
Comment:[graphspell] helpers: Map/Object conversion: return null if null given as parameter
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 7ab6e5b571c0508e31b38d270da36d487a955064f29a4a09eff3bbae393b2b18
User & Date: olr on 2018-03-07 13:27:39
Original Comment: [graphspell] helpers: Map/Object conversion: return null with null given as parameter
Other Links: manifest | tags
Context
2018-03-07
13:41
[fx][bug] workaround for weird bug (from Firefox?) while loading gc_options which may be an empty object check-in: 0eeca06c55 user: olr tags: trunk, fx
13:27
[graphspell] helpers: Map/Object conversion: return null if null given as parameter check-in: 7ab6e5b571 user: olr tags: trunk, graphspell
10:06
[fr] contrôle des drapeaux pour les verbes du 1ᵉʳ et du 2ᵉ groupe check-in: 13cbee29cd user: olr tags: trunk, fr
Changes

Modified graphspell-js/helpers.js from [d6421f5497] to [b70dea39e2].

70
71
72
73
74
75
76



77
78
79
80
81
82
83
84



85
86
87
88
89
90
91
            this.logerror(e);
            return null;
        }
    },

    // conversions
    objectToMap: function (obj) {



        let m = new Map();
        for (let param in obj) {
            m.set(param, obj[param]);
        }
        return m;
    },

    mapToObject: function (m) {



        let obj = {};
        for (let [k, v] of m) {
            obj[k] = v;
        }
        return obj;
    }
};







>
>
>








>
>
>







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
            this.logerror(e);
            return null;
        }
    },

    // conversions
    objectToMap: function (obj) {
        if (obj == null) {
            return null;
        }
        let m = new Map();
        for (let param in obj) {
            m.set(param, obj[param]);
        }
        return m;
    },

    mapToObject: function (m) {
        if (m == null) {
            return null;
        }
        let obj = {};
        for (let [k, v] of m) {
            obj[k] = v;
        }
        return obj;
    }
};