Repository navigation
Releases: aykutkardas/json-function
Releases · aykutkardas/json-function
Release list
v2.0.0
See Migrating from 1.x for how to update.
Changed (breaking)
- Chaining is immutable. Every method returns a new query, so a chain that is never run can no longer leak into the next query. Calling methods one by one without using the return value no longer builds a query, and the
resetRecordoption and theoption/dataproperties are removed. getQuery()returns an ordered array of steps, and steps run in the order they were added. Queries in the 1.x object format are still accepted.innerJoinis a real inner join: items without a match are dropped, and an item with several matches appears once per match.wherewith several queries returns each matching item once, in input order.searchmatches the key literally instead of as a regular expression, skips missing fields, and is case sensitive unlesscaseSensitive: falseis passed.- Stricter, generic TypeScript types.
- The package is an ES module and requires Node.js 20.19 or later.
require("json-function")still works on those versions; on older ones it fails withERR_REQUIRE_ESM.
Removed
transformand the chain's.transform().
Added
leftJoin, with one row per match.selectreads dotted paths with{ deep: true }.- Documentation moved from GitBook into the repository (
docs/). Its examples are run by the tests.
Fixed
orderByno longer sorts the input array in place.searchno longer throws for keys such as"c++", and missing fields no longer match as"undefined".- Keys named
__proto__in data or inselect/schemaarguments can no longer change object prototypes orObject.prototype. - A saved query no longer drops steps or replays them in a different order.
Optimized
- Queries on large arrays are much faster: property paths,
where,search,selectandschemaare compiled once instead of per item,orderByreads each sort key once, and chains run filters and limits in one pass and select the top items fororderBy+limit. For example,searchon 200,000 items went from 65 ms to 4 ms.
Documentation: https://github.com/aykutkardas/Json-Function/tree/main/docs
Full changes: #35
v1.8.40
Security fixes for the 1.x line. Published on npm with the legacy tag; latest is 2.x. Install it with npm install json-function@legacy.
Fixed
searchpassed the key toRegExpunescaped. A key such as"("threw, and a pattern such as"(a+)+$"could hang the process (ReDoS). The key is now matched as plain text, as documented.transformconverted a key such as"____proto____"to"__proto__"and assigned it, so JSON input could replace the prototype of the returned object. The key is now kept as an own property.
Code that relied on search treating the key as a regular expression gets plain-text matching instead. This behavior was never documented.
Both issues are also fixed in 2.0.0.
Full changes: #36
v1.8.35
- TypeScript support updated. 🔥
- General refactoring and optimization.🔧
- InnerJoin method is now x5 faster. 🚀
v1.8.16
v1.8.15
v1.8.4
v1.8.3
- TypeCheck methods problem fixed. 6711b88
v1.8.2
- ToArray Function added. fa8328c
- v1.8.1 3403354
- Build files. 1d3121f
- v1.8.0 207a3b2
- Merge branch 'master' of https://github.com/aykutkardas/Json-Function 9c71f74
- Merge branch 'master' of https://github.com/aykutkardas/Json-Function a773aee
- lodash.clonedeep removed. Basic clone function added. 70c1e81
- .npmignore file update. ba4a8b0
- Readme update. [ci skip] bc158ef
- WhereTool and SchemaTool optimization update. 13bb4d1
- README update. [ci skip] 1595de8
- v1.7.1 0941c34
- 1.7.0 24110a0
- Readme where function update. [ci-skip] 4fd353e
- Where Function files build. f35fc62
- Where function .between() method added with test. 8b2a20d
- Where Function methods test added. f82dd82
- strict equal remove & not equal added. 2dd01ae
- Where Tools .gt() method test aded. 0b5e2ec
- Advanced where calback methods added. e6daab2
- 1.6.2 0d537d8
- Schema option name changed "seperator" to "separator"; d534c71
- Added auto-completion and type support for editors. f53fba7
v1.8.1
v1.6.1
- Code refactor and optimization. Remove schema fields array and schemaToolGenerator move to seperate file . 46ac561