fiction
fiction copied to clipboard
1.8.31 - fixes to lodash-es issues, added variable depth schemaPopulated population
Please describe your change...
- bugfix - fixed lodash-es throwing REQUIRE_ESM_ERR by rewriting ./utils-lodash.ts and using base lodash library instead (files are imported individually, to maintain consistency) #260 #257
- api change - schemaPopulated now allows to populate nested values #261
- updated mini-css-extract-plugin to 1.3.6 - possibly breaking
For schemaPopulated, it now takes additional input which is an Array<string | string[]>, if string, it keeps the former behaviour of the function, if string[], it crawls individual array items it launches a recurrent crawling algorithm.
Let array be a list of object keys yet not of array indexes. Starting from the root of object try to find a path leading to the string value using the keys defined in the index, if an object value is an array, launch the algorithm on all array values and flatten the result. If the key value is incorrect, return an empty array. If the algorithm doesn't find the value with set keys, return an empty array. If the algorithm finds a string value regardless of the absolved depth, return the string as an array.
Example: for an object {'abc': [{'def': {'er': 'a'}},{'def': {'er': 'b'}}], 'def': 'bca', 'ghi': {'jkl': 'abc'}} on inputs
- ['abc', 'def', 'er'] returns ['a','b']
- ['def'] returns ['bca']
- ['abc'] returns []
- ['abc', 'def'] returns []
- ['ghi', 'jkl'] returns ['abc']
- ['ghi', 'jkl', 'ojm'] returns ['abc']
- ['ghi'] returns []
note: i forgot to bump version for @factor/post, it also received some changes