data-restructor 3.4.4 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.auto-changelog-template.hbs +1 -1
- package/.github/workflows/codeql-analysis.yml +6 -6
- package/.github/workflows/continuous-integration.yaml +11 -11
- package/.nvmrc +1 -0
- package/CHANGELOG.md +36 -1
- package/CONTRIBUTING.md +3 -3
- package/README.md +25 -25
- package/coverage/datarestructor.js.html +133 -133
- package/coverage/describedfield.js.html +45 -45
- package/coverage/index.html +1 -1
- package/coverage/templateResolver.js.html +26 -26
- package/devdist/datarestructor-ie.js +72 -7
- package/devdist/datarestructor.js +72 -7
- package/devdist/describedfield-ie.js +72 -7
- package/devdist/describedfield.js +72 -7
- package/devdist/templateResolver-ie.js +72 -7
- package/devdist/templateResolver.js +72 -7
- package/dist/datarestructor-ie.js +1 -1
- package/dist/datarestructor-ie.js.map +1 -1
- package/dist/datarestructor.js +1 -1
- package/dist/datarestructor.js.map +1 -1
- package/dist/describedfield-ie.js +1 -1
- package/dist/describedfield-ie.js.map +1 -1
- package/dist/describedfield.js +1 -1
- package/dist/describedfield.js.map +1 -1
- package/dist/templateResolver-ie.js +1 -1
- package/dist/templateResolver-ie.js.map +1 -1
- package/dist/templateResolver.js +1 -1
- package/dist/templateResolver.js.map +1 -1
- package/docs/datarestructor.js.html +1 -1
- package/docs/describedfield.js.html +1 -1
- package/docs/index.html +26 -26
- package/docs/module-datarestructor.DescribedEntryCreator.html +1 -1
- package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
- package/docs/module-datarestructor.Restructor.html +1 -1
- package/docs/module-datarestructor.Transform.html +1 -1
- package/docs/module-datarestructor.html +1 -1
- package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
- package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
- package/docs/module-described_field.html +1 -1
- package/docs/module-template_resolver.Resolver.html +1 -1
- package/docs/module-template_resolver.html +1 -1
- package/docs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AAW,EAAS,OAAO,CAAC,KAAO,EAAe,KAAM,GAE1D,OAAO,CACT,CACF,E,G,E,Q,S,C,C,C,EC1FF,IAAI,EAAS,GAAU,CAAC,CAmBxB,CAb4B,CAAA,EAAO,OAAO,CAAC,CAAC,CAAA,EAatB,cAAc,CAAG,SAAU,CAAI,CAAE,CAAiB,EACtE,IAAI,EAAS,EAAE,OACX,CAAA,AAA6B,UAA7B,OAAO,GAAkC,EAAoB,CAAA,GAC/D,CAAA,EAAoB,EADtB,EA+BA,AA5BA,SAAS,EAAQ,CAAG,CAAE,CAAI,CAAE,CAAK,EAC/B,GAAI,CAAA,CAAA,EAAQ,CAAA,GAAqB,AAAe,YAAf,OAAO,GAGxC,GAAI,OAAO,KAAS,EAClB,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,CAAI,QAChC,GAAI,MAAM,OAAO,CAAC,GAAM,CAE7B,IADI,EACA,EAAI,EAAI,MAAM,CAClB,IAAK,EAAI,EAAG,EAAI,EAAG,GAAK,EACtB,EAAQ,CAAG,CAAC,EAAE,CAAE,EAAO,IAAM,EAAI,IAAK,EAAQ,EAEtC,CAAA,IAAN,IACF,CAAM,CAAC,EAAK,CAAG,EAAE,CACjB,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,EAAG,GAExC,KAAO,CACL,IACI,EADA,EAAU,CAAA,EAEd,IAAK,KAAK,EACR,EAAU,CAAA,EACV,EAAQ,CAAG,CAAC,EAAE,CAAE,EAAO,EAAO,IAAM,EAAI,EAAG,EAAQ,GAEjD,GAAW,GACb,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,EAAG,EAExC,EACF,EACQ,EAAM,GAAI,GACX,CACT,C,G,E","sources":["<anon>","src/js/templateResolver.js","lib/js/flattenToArray.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"ds403\", function(module, exports) {\n/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $9cb0fe3475961b60$var$module = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists($9cb0fe3475961b60$var$module); // Fallback for vanilla js without modules\nfunction $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */ var $9cb0fe3475961b60$var$template_resolver = $9cb0fe3475961b60$var$module.exports = {}; // Export module for npm...\n$9cb0fe3475961b60$var$template_resolver.internalCreateIfNotExists = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists;\n\nvar $9cb0fe3475961b60$var$internal_object_tools = $9cb0fe3475961b60$var$internal_object_tools || (parcelRequire(\"ccQZb\")); // supports vanilla js & npm\n$9cb0fe3475961b60$var$template_resolver.Resolver = function() {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */ function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */ this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */ this.resolveTemplate = function(template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */ this.resolvableFieldsOfAll = function() {\n var map = {};\n var ignoreInternalFields = function(propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject($9cb0fe3475961b60$var$internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for(i = 0; i < propertyNames.length; i += 1){\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n return map;\n }\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return {\n group: propertyGroup,\n groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,\n name: propertyName\n };\n }\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for(index = 0; index < elements.length; index += 1){\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;\n }\n return mapObject;\n }\n return Resolver;\n}();\n\n});\nparcelRegister(\"ccQZb\", function(module, exports) {\n\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */ var $8e2fb4eb18d4597b$var$module = $8e2fb4eb18d4597b$var$module || {}; // Fallback for vanilla js without modules\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */ var $8e2fb4eb18d4597b$var$internal_object_tools = $8e2fb4eb18d4597b$var$module.exports = {}; // Export module for npm...\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */ /**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */ $8e2fb4eb18d4597b$var$internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) maxRecursionDepth = 20;\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") return;\n if (Object(cur) !== cur) result.push({\n name: prop,\n value: cur\n });\n else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for(i = 0; i < l; i += 1)recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n if (l === 0) {\n result[prop] = [];\n result.push({\n name: prop,\n value: \"\"\n });\n }\n } else {\n var isEmpty = true;\n var p;\n for(p in cur){\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) result.push({\n name: prop,\n value: \"\"\n });\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n\n});\n\n\n\nparcelRequire(\"ds403\");\n\n//# sourceMappingURL=templateResolver.js.map\n","/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */\nvar template_resolver = (module.exports = {}); // Export module for npm...\ntemplate_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;\n\nvar internal_object_tools = internal_object_tools || require(\"../../lib/js/flattenToArray\"); // supports vanilla js & npm\n\ntemplate_resolver.Resolver = (function () {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */\n function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */\n this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */\n this.resolveTemplate = function (template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */\n this.resolvableFieldsOfAll = function () {\n var map = {};\n var ignoreInternalFields = function (propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for (index = 0; index < arguments.length; index += 1) {\n addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n }\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */\n this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for (i = 0; i < propertyNames.length; i += 1) {\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") {\n map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n }\n return map;\n }\n\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) {\n propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n }\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) {\n propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n }\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return { group: propertyGroup, groupWithoutArrayIndices: propertyGroupWithoutArrayIndices, name: propertyName };\n }\n\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for (index = 0; index < elements.length; index += 1) {\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) {\n mapObject[element.name] = element.value;\n }\n }\n return mapObject;\n }\n\n return Resolver;\n}());\n","\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */\nvar module = module || {}; // Fallback for vanilla js without modules\n\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */\nvar internal_object_tools = module.exports={}; // Export module for npm...\n\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */\n\n/**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */\ninternal_object_tools.flattenToArray = function (data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) {\n maxRecursionDepth = 20;\n }\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") {\n return;\n }\n if (Object(cur) !== cur) {\n result.push({ name: prop, value: cur });\n } else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for (i = 0; i < l; i += 1) {\n recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n }\n if (l === 0) {\n result[prop] = [];\n result.push({ name: prop, value: \"\" });\n }\n } else {\n var isEmpty = true;\n var p;\n for (p in cur) {\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) {\n result.push({ name: prop, value: \"\" });\n }\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","removeArrayBracketsRegEx","$9cb0fe3475961b60$var$module","$9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists","objectToCheck","$9cb0fe3475961b60$var$template_resolver","internalCreateIfNotExists","$9cb0fe3475961b60$var$internal_object_tools","Resolver","RegExp","sourceDataObject","resolveTemplate","template","replaceResolvableFields","addFieldsPerGroup","map","i","fullPropertyName","propertyInfo","propertyValue","propertyNames","Object","keys","length","getPropertyNameInfos","positionOfRightMostSeparator","lastIndexOf","propertyName","substr","propertyGroup","propertyGroupWithoutArrayIndices","replace","group","groupWithoutArrayIndices","name","resolvableFieldsOfAll","index","ignoreInternalFields","indexOf","arguments","addToFilteredMapObject","elements","mapObject","filterMatchesFunction","element","value","flattenToArray","stringContainingVariables","resolvableFields","replaced","propertyIndex","$8e2fb4eb18d4597b$var$module","$8e2fb4eb18d4597b$var$internal_object_tools","data","maxRecursionDepth","result","recurse","cur","prop","depth","push","Array","isArray","l","p","isEmpty"],"version":3,"file":"templateResolver.js.map","sourceRoot":"../"}
|
|
1
|
+
{"mappings":"A,I,e,W,gB,C,E,c,C,E,c,e,iB,A,O,gB,A,C,c,S,C,E,G,K,gB,O,e,C,E,C,O,C,G,K,c,C,I,E,a,C,E,A,Q,a,C,E,C,I,E,C,G,E,Q,C,C,E,O,e,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,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kC,EAAoB,CAAA,GAC/D,CAAA,EAAoB,EADtB,GA+BA,AA5BA,SAAS,EAAQ,CAAG,CAAE,CAAI,CAAE,CAAK,EAC/B,GAAI,CAAA,CAAA,EAAQ,CAAA,GAAqB,AAAe,YAAf,OAAO,EAGxC,GAAI,OAAO,KAAS,EAClB,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,CAAI,QAChC,GAAI,MAAM,OAAO,CAAC,GAAM,CAE7B,IADI,EACA,EAAI,EAAI,MAAM,CAClB,IAAK,EAAI,EAAG,EAAI,EAAG,GAAK,EACtB,EAAQ,CAAG,CAAC,EAAE,CAAE,EAAO,IAAM,EAAI,IAAK,EAAQ,EAEtC,CAAA,IAAN,IACF,CAAM,CAAC,EAAK,CAAG,EAAE,CACjB,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,EAAG,GAExC,KAAO,CACL,IACI,EADA,EAAU,CAAA,EAEd,IAAK,KAAK,EACR,EAAU,CAAA,EACV,EAAQ,CAAG,CAAC,EAAE,CAAE,EAAO,EAAO,IAAM,EAAI,EAAG,EAAQ,EAEjD,CAAA,GAAW,GACb,EAAO,IAAI,CAAC,CAAE,KAAM,EAAM,MAAO,EAAG,EAExC,CACF,EACQ,EAAM,GAAI,GACX,CACT,C,G,c","sources":["<anon>","src/js/templateResolver.js","lib/js/flattenToArray.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"ds403\", function(module, exports) {\n/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $9cb0fe3475961b60$var$module = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists($9cb0fe3475961b60$var$module); // Fallback for vanilla js without modules\nfunction $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */ var $9cb0fe3475961b60$var$template_resolver = $9cb0fe3475961b60$var$module.exports = {}; // Export module for npm...\n$9cb0fe3475961b60$var$template_resolver.internalCreateIfNotExists = $9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists;\n\nvar $9cb0fe3475961b60$var$internal_object_tools = $9cb0fe3475961b60$var$internal_object_tools || (parcelRequire(\"ccQZb\")); // supports vanilla js & npm\n$9cb0fe3475961b60$var$template_resolver.Resolver = function() {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */ function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */ this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */ this.resolveTemplate = function(template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */ this.resolvableFieldsOfAll = function() {\n var map = {};\n var ignoreInternalFields = function(propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for(index = 0; index < arguments.length; index += 1)addToFilteredMapObject($9cb0fe3475961b60$var$internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */ this.replaceResolvableFields = function(stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for(propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1){\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for(i = 0; i < propertyNames.length; i += 1){\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n return map;\n }\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return {\n group: propertyGroup,\n groupWithoutArrayIndices: propertyGroupWithoutArrayIndices,\n name: propertyName\n };\n }\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */ function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for(index = 0; index < elements.length; index += 1){\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) mapObject[element.name] = element.value;\n }\n return mapObject;\n }\n return Resolver;\n}();\n\n});\nparcelRegister(\"ccQZb\", function(module, exports) {\n\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */ var $8e2fb4eb18d4597b$var$module = $8e2fb4eb18d4597b$var$module || {}; // Fallback for vanilla js without modules\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */ var $8e2fb4eb18d4597b$var$internal_object_tools = $8e2fb4eb18d4597b$var$module.exports = {}; // Export module for npm...\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */ /**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */ $8e2fb4eb18d4597b$var$internal_object_tools.flattenToArray = function(data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) maxRecursionDepth = 20;\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") return;\n if (Object(cur) !== cur) result.push({\n name: prop,\n value: cur\n });\n else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for(i = 0; i < l; i += 1)recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n if (l === 0) {\n result[prop] = [];\n result.push({\n name: prop,\n value: \"\"\n });\n }\n } else {\n var isEmpty = true;\n var p;\n for(p in cur){\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) result.push({\n name: prop,\n value: \"\"\n });\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n\n});\n\n\n\nparcelRequire(\"ds403\");\n\n//# sourceMappingURL=templateResolver.js.map\n","/**\n * @file Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = templateResolverInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction templateResolverInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Provides a simple template resolver, that replaces variables in double curly brackets with the values of a given object.\n * @module template_resolver\n */\nvar template_resolver = (module.exports = {}); // Export module for npm...\ntemplate_resolver.internalCreateIfNotExists = templateResolverInternalCreateIfNotExists;\n\nvar internal_object_tools = internal_object_tools || require(\"../../lib/js/flattenToArray\"); // supports vanilla js & npm\n\ntemplate_resolver.Resolver = (function () {\n var removeArrayBracketsRegEx = new RegExp(\"\\\\[\\\\d+\\\\]\", \"gi\");\n\n /**\n * Resolver. Is used inside this repository. It could also be used outside.\n * @param {*} sourceDataObject The properties of this object will be used to replace the placeholders in the template.\n * @constructs Resolver\n * @alias module:template_resolver.Resolver\n */\n function Resolver(sourceDataObject) {\n /**\n * The properties of this source data object will be used to replace the placeholders in the template.\n */\n this.sourceDataObject = sourceDataObject;\n /**\n * Resolves the given template.\n *\n * The template may contain variables in double curly brackets.\n * Supported variables are all properties of this object, e.g. \"{{fieldName}}\", \"{{displayName}}\", \"{{value}}\".\n * Since this object may also contains (described) groups of sub objects, they can also be used, e.g. \"{{summaries[0].value}}\"\n * Parts of the index can be inserted by using e.g. \"{{index[1]}}\".\n *\n * @param {string} template\n * @returns {string} resolved template\n */\n this.resolveTemplate = function (template) {\n return this.replaceResolvableFields(template, addFieldsPerGroup(this.resolvableFieldsOfAll(this.sourceDataObject)));\n };\n /**\n * Returns a map like object, that contains all resolvable fields and their values as properties.\n * This function takes a variable count of input parameters,\n * each containing an object that contains resolvable fields to extract from.\n *\n * The recursion depth is limited to 3, so that an object,\n * that contains an object can contain another object (but not further).\n *\n * Properties beginning with an underscore in their name will be filtered out, since they are considered as internal fields.\n *\n * @param {...object} varArgs variable count of parameters. Each parameter contains an object that fields should be resolvable for variables.\n * @returns {object} object with resolvable field names and their values.\n * @public\n */\n this.resolvableFieldsOfAll = function () {\n var map = {};\n var ignoreInternalFields = function (propertyName) {\n return propertyName.indexOf(\"_\") !== 0 && propertyName.indexOf(\"._\") < 0;\n };\n var index;\n for (index = 0; index < arguments.length; index += 1) {\n addToFilteredMapObject(internal_object_tools.flattenToArray(arguments[index], 3), map, ignoreInternalFields);\n }\n return map;\n };\n /**\n * Replaces all variables in double curly brackets, e.g. {{property}},\n * with the value of that property from the resolvableProperties.\n *\n * Supported property types: string, number, boolean\n * @param {string} stringContainingVariables\n * @param {object[]} resolvableFields (name=value)\n */\n this.replaceResolvableFields = function (stringContainingVariables, resolvableFields) {\n var replaced = stringContainingVariables;\n var propertyNames = Object.keys(resolvableFields);\n var propertyIndex = 0;\n var propertyName = \"\";\n var propertyValue = \"\";\n for (propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex += 1) {\n propertyName = propertyNames[propertyIndex];\n propertyValue = resolvableFields[propertyName];\n replaced = replaced.replace(\"{{\" + propertyName + \"}}\", propertyValue);\n }\n return replaced;\n };\n }\n\n /**\n * Adds the value of the \"fieldName\" property (including its group prefix) and its associated \"value\" property content.\n * For example: detail[2].fieldName=\"name\", detail[2].value=\"Smith\" lead to the additional property detail.name=\"Smith\".\n * @param {object} object with resolvable field names and their values.\n * @returns {object} object with resolvable field names and their values.\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addFieldsPerGroup(map) {\n var propertyNames = Object.keys(map);\n var i, fullPropertyName, propertyInfo, propertyValue;\n for (i = 0; i < propertyNames.length; i += 1) {\n fullPropertyName = propertyNames[i];\n propertyValue = map[fullPropertyName];\n propertyInfo = getPropertyNameInfos(fullPropertyName);\n // Supports fields that are defined by a property named \"fieldName\" (containing the name)\n // and a property named \"value\" inside the same sub object (containing its value).\n // Ignore custom fields that are named \"fieldName\"(propertyValue), since this would lead to an unpredictable behavior.\n // TODO could make \"fieldName\" and \"value\" configurable\n if (propertyInfo.name === \"fieldName\" && propertyValue !== \"fieldName\") {\n map[propertyInfo.groupWithoutArrayIndices + propertyValue] = map[propertyInfo.group + \"value\"];\n }\n }\n return map;\n }\n\n /**\n * Infos about the full property name including the name of the group (followed by the separator) and the name of the property itself.\n * @param {String} fullPropertyName\n * @returns {Object} Contains \"group\" (empty or group name including trailing separator \".\"), \"groupWithoutArrayIndices\" and \"name\" (property name).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function getPropertyNameInfos(fullPropertyName) {\n var positionOfRightMostSeparator = fullPropertyName.lastIndexOf(\".\");\n var propertyName = fullPropertyName;\n if (positionOfRightMostSeparator > 0) {\n propertyName = fullPropertyName.substr(positionOfRightMostSeparator + 1);\n }\n var propertyGroup = \"\";\n if (positionOfRightMostSeparator > 0) {\n propertyGroup = fullPropertyName.substr(0, positionOfRightMostSeparator + 1); //includes the trailing \".\".\n }\n var propertyGroupWithoutArrayIndices = propertyGroup.replace(removeArrayBracketsRegEx, \"\");\n return { group: propertyGroup, groupWithoutArrayIndices: propertyGroupWithoutArrayIndices, name: propertyName };\n }\n\n /**\n * Collects all flattened name-value-pairs into one object using the property names as keys and their values as values (map-like).\n * Example: `{name: \"accountNumber\", value: \"12345\"}` becomes `mapObject[\"accountNumber\"]=\"12345\"`.\n *\n * @param {NameValuePair[]} elements flattened array of name-value-pairs\n * @param {object} mapObject container to collect the results. Needs to be created before e.g. using `{}`.\n * @param {function} filterMatchesFunction takes the property name as string argument and returns true (include) or false (exclude).\n * @protected\n * @memberof module:template_resolver.Resolver\n */\n function addToFilteredMapObject(elements, mapObject, filterMatchesFunction) {\n var index, element;\n for (index = 0; index < elements.length; index += 1) {\n element = elements[index];\n if (typeof filterMatchesFunction === \"function\" && filterMatchesFunction(element.name)) {\n mapObject[element.name] = element.value;\n }\n }\n return mapObject;\n }\n\n return Resolver;\n}());\n","\"use strict\";\n/**\n * @fileOverview Modded (compatibility, recursion depth) version of: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss\n * @version ${project.version}\n * @see {@link https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objectss|stackoverflow flatten nested json objects}\n */\nvar module = module || {}; // Fallback for vanilla js without modules\n\n/**\n * internal_object_tools. Not meant to be used outside this repository.\n * @default {}\n */\nvar internal_object_tools = module.exports={}; // Export module for npm...\n\n/**\n * @typedef {Object} NameValuePair\n * @property {string} name - point separated names of the flattened main and sub properties, e.g. \"responses[2].hits.hits[4]._source.name\".\n * @property {string} value - value of the property\n */\n\n/**\n * @param {object} data hierarchical object that may consist fo fields, subfields and arrays.\n * @param {number} maxRecursionDepth\n * @returns {NameValuePair[]} array of property name and value pairs\n */\ninternal_object_tools.flattenToArray = function (data, maxRecursionDepth) {\n var result = [];\n if (typeof maxRecursionDepth !== \"number\" || maxRecursionDepth < 1) {\n maxRecursionDepth = 20;\n }\n function recurse(cur, prop, depth) {\n if (depth > maxRecursionDepth || typeof cur === \"function\") {\n return;\n }\n if (Object(cur) !== cur) {\n result.push({ name: prop, value: cur });\n } else if (Array.isArray(cur)) {\n var i;\n var l = cur.length;\n for (i = 0; i < l; i += 1) {\n recurse(cur[i], prop + \"[\" + i + \"]\", depth + 1);\n }\n if (l === 0) {\n result[prop] = [];\n result.push({ name: prop, value: \"\" });\n }\n } else {\n var isEmpty = true;\n var p;\n for (p in cur) {\n isEmpty = false;\n recurse(cur[p], prop ? prop + \".\" + p : p, depth + 1);\n }\n if (isEmpty && prop) {\n result.push({ name: prop, value: \"\" });\n }\n }\n }\n recurse(data, \"\", 0);\n return result;\n};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","removeArrayBracketsRegEx","$9cb0fe3475961b60$var$module","$9cb0fe3475961b60$var$templateResolverInternalCreateIfNotExists","objectToCheck","$9cb0fe3475961b60$var$template_resolver","internalCreateIfNotExists","$9cb0fe3475961b60$var$internal_object_tools","RegExp","Resolver","sourceDataObject","resolveTemplate","template","replaceResolvableFields","addFieldsPerGroup","map","i","fullPropertyName","propertyInfo","propertyValue","propertyNames","Object","keys","length","getPropertyNameInfos","positionOfRightMostSeparator","lastIndexOf","propertyName","substr","propertyGroup","propertyGroupWithoutArrayIndices","replace","group","groupWithoutArrayIndices","name","resolvableFieldsOfAll","index","ignoreInternalFields","indexOf","arguments","addToFilteredMapObject","elements","mapObject","filterMatchesFunction","element","value","flattenToArray","stringContainingVariables","resolvableFields","replaced","propertyIndex","$8e2fb4eb18d4597b$var$module","$8e2fb4eb18d4597b$var$internal_object_tools","data","maxRecursionDepth","result","recurse","cur","prop","depth","push","Array","isArray","l","p","isEmpty"],"version":3,"file":"templateResolver.js.map","sourceRoot":"../"}
|
|
@@ -1280,7 +1280,7 @@ datarestructor.Restructor.processJsonUsingDescriptions = function(jsonData, desc
|
|
|
1280
1280
|
<br class="clear">
|
|
1281
1281
|
|
|
1282
1282
|
<footer>
|
|
1283
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
1283
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
1284
1284
|
</footer>
|
|
1285
1285
|
|
|
1286
1286
|
<script> prettyPrint(); </script>
|
|
@@ -334,7 +334,7 @@ described_field.DescribedDataFieldGroup = (function () {
|
|
|
334
334
|
<br class="clear">
|
|
335
335
|
|
|
336
336
|
<footer>
|
|
337
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
337
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
338
338
|
</footer>
|
|
339
339
|
|
|
340
340
|
<script> prettyPrint(); </script>
|
package/docs/index.html
CHANGED
|
@@ -74,20 +74,20 @@ If the structure evolves over time, it leads to recurring changes in the code th
|
|
|
74
74
|
<pre class="prettyprint source lang-shell"><code>npm install data-restructor
|
|
75
75
|
</code></pre>
|
|
76
76
|
<p>Alternatively, the sources can be found inside the
|
|
77
|
-
<a href="https://github.com/JohT/data-restructor-js/tree/
|
|
77
|
+
<a href="https://github.com/JohT/data-restructor-js/tree/main/src/">source folder</a>:</p>
|
|
78
78
|
<ul>
|
|
79
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
80
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
81
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
79
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/src/js/datarestructor.js">datarestructor.js</a></li>
|
|
80
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/src/js/templateResolver.js">templateResolver.js</a></li>
|
|
81
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/src/js/describedfield.js">describedfield.js</a></li>
|
|
82
82
|
</ul>
|
|
83
83
|
<p>The development artifacts (not minified) can be found inside the
|
|
84
|
-
<a href="https://github.com/JohT/data-restructor-js/tree/
|
|
84
|
+
<a href="https://github.com/JohT/data-restructor-js/tree/main/devdist">devdist folder</a>:</p>
|
|
85
85
|
<ul>
|
|
86
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
87
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
88
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
89
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
90
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
86
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/devdist/datarestructor-ie-global-all.js">datarestructor-ie-global-all.js</a> all sources including polyfills merged to be used without module system</li>
|
|
87
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/devdist/datarestructor-global-all.js">datarestructor-global-all.js</a> all sources without polyfills merged to be used without module system</li>
|
|
88
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/devdist/datarestructor.js">datarestructor.js</a></li>
|
|
89
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/devdist/templateResolver.js">templateResolver.js</a></li>
|
|
90
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/devdist/describedfield.js">describedfield.js</a></li>
|
|
91
91
|
</ul>
|
|
92
92
|
<p>Here are some code examples on how these modules can be imported:</p>
|
|
93
93
|
<pre class="prettyprint source lang-javascript"><code>var template_resolver = template_resolver || require("data-restructor/devdist/templateResolver"); // supports vanilla js
|
|
@@ -95,16 +95,16 @@ var described_field = described_field || require("data-restructor/devdist/d
|
|
|
95
95
|
var datarestructor = datarestructor || require("data-restructor/devdist/datarestructor"); // supports vanilla js
|
|
96
96
|
</code></pre>
|
|
97
97
|
<p>The built (minified) versions can be found inside the
|
|
98
|
-
<a href="https://github.com/JohT/data-restructor-js/tree/
|
|
98
|
+
<a href="https://github.com/JohT/data-restructor-js/tree/main/dist">distribution folder</a>:</p>
|
|
99
99
|
<ul>
|
|
100
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
101
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
102
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
103
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
104
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
105
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
106
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
107
|
-
<li><a href="https://github.com/JohT/data-restructor-js/blob/
|
|
100
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/datarestructor-ie-global-all-min.js">datarestructor-ie-global-all-min.js</a> all sources including polyfills merged and minified to be used without module system</li>
|
|
101
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/datarestructor-global-all-min.js">datarestructor-global-all-min.js</a> all sources without polyfills merged and minified to be used without module system</li>
|
|
102
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/datarestructor.js">datarestructor.js</a></li>
|
|
103
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/datarestructor-ie.js">datarestructor-ie.js</a> (full compatibility with IE)</li>
|
|
104
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/templateResolver.js">templateResolver.js</a></li>
|
|
105
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/templateResolver-ie.js">templateResolver-ie.js</a> (full compatibility with IE)</li>
|
|
106
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/describedfield.js">describedfield.js</a></li>
|
|
107
|
+
<li><a href="https://github.com/JohT/data-restructor-js/blob/main/dist/describedfield-ie.js">describedfield-ie.js</a> (full compatibility with IE)</li>
|
|
108
108
|
</ul>
|
|
109
109
|
<h2>Code Documentation</h2>
|
|
110
110
|
<p>The <a href="https://joht.github.io/data-restructor-js">code documentation</a> is generated using <a href="https://jsdoc.app">JSDoc</a> and is published using <a href="https://pages.github.com">GitHub Pages</a> at <a href="https://joht.github.io/data-restructor-js">https://joht.github.io/data-restructor-js</a>.</p>
|
|
@@ -118,7 +118,7 @@ npm run package
|
|
|
118
118
|
<h2>Example</h2>
|
|
119
119
|
<p>As a starting point you may have a look at the following example.<br>
|
|
120
120
|
A running, comprehensive example can be found here:
|
|
121
|
-
<a href="https://github.com/JohT/data-restructor-js/blob/
|
|
121
|
+
<a href="https://github.com/JohT/data-restructor-js/blob/main/test/js/DataRestructorUseCaseTest.js">DataRestructorUseCaseTest.js</a></p>
|
|
122
122
|
<h3>Input Object</h3>
|
|
123
123
|
<pre class="prettyprint source lang-json"><code>{
|
|
124
124
|
"responses": [
|
|
@@ -483,14 +483,14 @@ That leads to recursion and duplication, that need to be limited. This can be co
|
|
|
483
483
|
<h2>Credits</h2>
|
|
484
484
|
<p>Although this project doesn't use any runtime dependencies, it is created using these great tools:</p>
|
|
485
485
|
<ul>
|
|
486
|
-
<li><a href="https://eslint.org">ESLint</a> - <a href="https://github.com/eslint/eslint/blob/
|
|
486
|
+
<li><a href="https://eslint.org">ESLint</a> - <a href="https://github.com/eslint/eslint/blob/main/LICENSE">MIT License</a></li>
|
|
487
487
|
<li><a href="https://www.npmjs.com/package/istanbul-badges-readme">istanbul-badges-readme</a> - <a href="https://github.com/olavoparno/istanbul-badges-readme/blob/develop/LICENSE">MIT License</a></li>
|
|
488
488
|
<li><a href="https://jasmine.github.io">Jasmine</a> - <a href="https://github.com/jasmine/jasmine/blob/main/MIT.LICENSE">MIT License</a></li>
|
|
489
|
-
<li><a href="https://jsdoc.app">JSDoc</a> - <a href="https://github.com/jsdoc/jsdoc/blob/
|
|
490
|
-
<li><a href="https://github.com/joao-neves95/merger-js">merger-js</a> - <a href="https://github.com/joao-neves95/merger-js/blob/
|
|
491
|
-
<li><a href="https://istanbul.js.org">NYC aka Istanbul</a> - <a href="https://github.com/istanbuljs/nyc/blob/
|
|
489
|
+
<li><a href="https://jsdoc.app">JSDoc</a> - <a href="https://github.com/jsdoc/jsdoc/blob/main/LICENSE">Apache Licence 2.0</a></li>
|
|
490
|
+
<li><a href="https://github.com/joao-neves95/merger-js">merger-js</a> - <a href="https://github.com/joao-neves95/merger-js/blob/main/LICENSE.md">GNU General Public License v3.0</a></li>
|
|
491
|
+
<li><a href="https://istanbul.js.org">NYC aka Istanbul</a> - <a href="https://github.com/istanbuljs/nyc/blob/main/LICENSE.txt">ISC License</a></li>
|
|
492
492
|
<li><a href="https://v2.parceljs.org">PARCEL</a> - <a href="https://github.com/parcel-bundler/parcel/blob/v2/LICENSE">MIT License</a></li>
|
|
493
|
-
<li><a href="https://github.com/joao-neves95/merger-js">merger-js</a> - <a href="https://github.com/joao-neves95/merger-js/blob/
|
|
493
|
+
<li><a href="https://github.com/joao-neves95/merger-js">merger-js</a> - <a href="https://github.com/joao-neves95/merger-js/blob/main/LICENSE.md">GNU General Public License v3.0</a></li>
|
|
494
494
|
</ul></article>
|
|
495
495
|
</section>
|
|
496
496
|
|
|
@@ -817,7 +817,7 @@ That leads to recursion and duplication, that need to be limited. This can be co
|
|
|
817
817
|
<br class="clear">
|
|
818
818
|
|
|
819
819
|
<footer>
|
|
820
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
820
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
821
821
|
</footer>
|
|
822
822
|
|
|
823
823
|
<script> prettyPrint(); </script>
|
|
@@ -905,7 +905,7 @@ This is the public version of the internal variable _identifier.index, which con
|
|
|
905
905
|
<br class="clear">
|
|
906
906
|
|
|
907
907
|
<footer>
|
|
908
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
908
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
909
909
|
</footer>
|
|
910
910
|
|
|
911
911
|
<script> prettyPrint(); </script>
|
|
@@ -2948,7 +2948,7 @@ starts with the "propertyPattern".</p>
|
|
|
2948
2948
|
<br class="clear">
|
|
2949
2949
|
|
|
2950
2950
|
<footer>
|
|
2951
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
2951
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
2952
2952
|
</footer>
|
|
2953
2953
|
|
|
2954
2954
|
<script> prettyPrint(); </script>
|
|
@@ -339,7 +339,7 @@ var result = datarestructor.Restructor.processJsonUsingDescriptions(jsonData, al
|
|
|
339
339
|
<br class="clear">
|
|
340
340
|
|
|
341
341
|
<footer>
|
|
342
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
342
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
343
343
|
</footer>
|
|
344
344
|
|
|
345
345
|
<script> prettyPrint(); </script>
|
|
@@ -3094,7 +3094,7 @@ in a recursive manner. The maximum recursion depth is taken as the second parame
|
|
|
3094
3094
|
<br class="clear">
|
|
3095
3095
|
|
|
3096
3096
|
<footer>
|
|
3097
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
3097
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
3098
3098
|
</footer>
|
|
3099
3099
|
|
|
3100
3100
|
<script> prettyPrint(); </script>
|
|
@@ -2734,7 +2734,7 @@ how the data should be transformed.</p>
|
|
|
2734
2734
|
<br class="clear">
|
|
2735
2735
|
|
|
2736
2736
|
<footer>
|
|
2737
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
2737
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
2738
2738
|
</footer>
|
|
2739
2739
|
|
|
2740
2740
|
<script> prettyPrint(); </script>
|
|
@@ -2123,7 +2123,7 @@ Example: "responses[2].hits.hits[4]._source.name" will have an index o
|
|
|
2123
2123
|
<br class="clear">
|
|
2124
2124
|
|
|
2125
2125
|
<footer>
|
|
2126
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
2126
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
2127
2127
|
</footer>
|
|
2128
2128
|
|
|
2129
2129
|
<script> prettyPrint(); </script>
|
|
@@ -577,7 +577,7 @@ that contain an array of sub fields of the same type <a href="module-described_f
|
|
|
577
577
|
<br class="clear">
|
|
578
578
|
|
|
579
579
|
<footer>
|
|
580
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
580
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
581
581
|
</footer>
|
|
582
582
|
|
|
583
583
|
<script> prettyPrint(); </script>
|
|
@@ -747,7 +747,7 @@ Dynamically added properties represent custom named groups containing DescribedD
|
|
|
747
747
|
<br class="clear">
|
|
748
748
|
|
|
749
749
|
<footer>
|
|
750
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
750
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
751
751
|
</footer>
|
|
752
752
|
|
|
753
753
|
<script> prettyPrint(); </script>
|
|
@@ -1285,7 +1285,7 @@ Example: <code>{name: "accountNumber", value: "12345"}</code
|
|
|
1285
1285
|
<br class="clear">
|
|
1286
1286
|
|
|
1287
1287
|
<footer>
|
|
1288
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
1288
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
1289
1289
|
</footer>
|
|
1290
1290
|
|
|
1291
1291
|
<script> prettyPrint(); </script>
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
<br class="clear">
|
|
128
128
|
|
|
129
129
|
<footer>
|
|
130
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
130
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
131
131
|
</footer>
|
|
132
132
|
|
|
133
133
|
<script> prettyPrint(); </script>
|
|
@@ -210,7 +210,7 @@ template_resolver.Resolver = (function () {
|
|
|
210
210
|
<br class="clear">
|
|
211
211
|
|
|
212
212
|
<footer>
|
|
213
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.
|
|
213
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Sun Feb 01 2026 09:22:06 GMT+0000 (Coordinated Universal Time)
|
|
214
214
|
</footer>
|
|
215
215
|
|
|
216
216
|
<script> prettyPrint(); </script>
|
package/merger-config.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"mergerJsLinks": {
|
|
3
3
|
"npm": "https://www.npmjs.com/package/merger-js",
|
|
4
4
|
"github": "https://github.com/joao-neves95/merger-js",
|
|
5
|
-
"readme": "https://github.com/joao-neves95/merger-js/blob/
|
|
6
|
-
"changelog": "https://github.com/joao-neves95/merger-js/blob/
|
|
5
|
+
"readme": "https://github.com/joao-neves95/merger-js/blob/main/README.md",
|
|
6
|
+
"changelog": "https://github.com/joao-neves95/merger-js/blob/main/CHANGELOG.md"
|
|
7
7
|
},
|
|
8
8
|
"autoBuild": false,
|
|
9
9
|
"notifications": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-restructor",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "Transforms parsed JSON objects into a uniform data structure",
|
|
5
5
|
"directories": {
|
|
6
6
|
"test": "test"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": "
|
|
18
|
+
"node": "24"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"prebuild": "rm -rf dist",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"merger": "echo -ne \"k\n\" | npx merger build",
|
|
28
28
|
"dev": "rm -rf devdist && parcel --out-dir devdist ./src/js/*.js",
|
|
29
29
|
"devbuild": "rm -rf devdist && NODE_ENV=development parcel build --dist-dir devdist ./src/js/*.js --no-optimize --no-source-maps --no-scope-hoist --no-content-hash --detailed-report",
|
|
30
|
-
"build": "
|
|
30
|
+
"build": "parcel build ./src/js/*.js",
|
|
31
31
|
"changelog": "auto-changelog",
|
|
32
32
|
"changelog-debug": "auto-changelog --template json --output changelog-data.json",
|
|
33
33
|
"package": "npm run lint && npm run coverage && npm run coverage-badge && npm run doc && npm run changelog && npm run devbuild && npm run build && npm run merger"
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://joht.github.io/data-restructor-js",
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@eslint/js": "9.
|
|
51
|
+
"@eslint/js": "9.39.2",
|
|
52
52
|
"auto-changelog": "2.5.0",
|
|
53
|
-
"eslint": "9.
|
|
54
|
-
"inquirer": "
|
|
53
|
+
"eslint": "9.39.2",
|
|
54
|
+
"inquirer": "13.2.2",
|
|
55
55
|
"istanbul-badges-readme": "1.9.0",
|
|
56
|
-
"jasmine": "
|
|
57
|
-
"jsdoc": "4.0.
|
|
58
|
-
"lmdb": "3.
|
|
56
|
+
"jasmine": "6.0.0",
|
|
57
|
+
"jsdoc": "4.0.5",
|
|
58
|
+
"lmdb": "3.5.1",
|
|
59
59
|
"merger-js": "3.10.3",
|
|
60
60
|
"node-notifier": "10.0.1",
|
|
61
61
|
"nyc": "17.1.0",
|
|
62
|
-
"parcel": "2.
|
|
62
|
+
"parcel": "2.16.3"
|
|
63
63
|
}
|
|
64
64
|
}
|