UNPKG

syphonx-core

Version:

SyphonX is a template-driven solution for extracting data from HTML in a highly efficient way. It combines the power of jQuery, Regular Expressions, and Javascript into a declarative template-driven format that extracts and reshapes HTML data into JSON.

26 lines 707 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unwind = void 0; function unwind(obj) { var key = Object.keys(obj)[0]; if (key.includes(".")) { var value = obj[key]; var keys = key.split("."); obj = {}; var p = obj; for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { var k = keys_1[_i]; var lastOne = keys.indexOf(k) === keys.length - 1; if (!lastOne) { p[k] = {}; p = p[k]; } else { p[k] = value; } } } return obj; } exports.unwind = unwind; //# sourceMappingURL=unwind.js.map