MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / entriesToObject

Function entriesToObject

libraries/p5.js:3026–3046  ·  view source on GitHub ↗
(entries)

Source from the content-addressed store, hash-verified

3024// Convert the entries returned by `parseDict` to a proper dictionary.
3025// If a value is a list of one, it is unpacked.
3026function entriesToObject(entries) {
3027 var o = {};
3028 for (var i = 0; i < entries.length; i += 1) {
3029 var key = entries[i][0];
3030 var values = entries[i][1];
3031 var value;
3032 if (values.length === 1) {
3033 value = values[0];
3034 } else {
3035 value = values;
3036 }
3037
3038 if (o.hasOwnProperty(key)) {
3039 throw new Error('Object ' + o + ' already has key ' + key);
3040 }
3041
3042 o[key] = value;
3043 }
3044
3045 return o;
3046}
3047
3048// Parse a `CFF` DICT object.
3049// A dictionary contains key-value pairs in a compact tokenized format.

Callers 1

parseCFFDictFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected