UNPKG

collectable

Version:

An all-you-can-eat buffet of high-performance immutable/persistent data structures

35 lines (33 loc) 992 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const functions_1 = require("../functions"); function isIndexable(type) { return type.indexable; } exports.isIndexable = isIndexable; function convertValue(value) { if (value && typeof value === 'object') { if (Array.isArray(value)) { return functions_1.fromArray(value); } if (value.constructor === Object) { return functions_1.fromObject(value); } if (value instanceof Map) { return functions_1.fromMap(value); } if (value instanceof Set) { return functions_1.fromSet(value); } if (Symbol.iterator in value) { return functions_1.fromIterable(value); } } return value; } exports.convertValue = convertValue; function convertPair(entry) { return [entry[0], convertValue(entry[1])]; } exports.convertPair = convertPair; //# sourceMappingURL=common.js.map