1.0.1 • Published 4 years ago

fast-path-set v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

fast-path-set

A fast drop-in replacement for lodash.set.

Install

$ npm i fast-path-set --save

Usage

const set = require('fast-path-set')
const obj = {}
set(obj, 'a.b.c', 1)
console.log(obj.a.b.c)

Check test.js for more detailed usage examples. There is one key difference to lodash.set, which is the fact fast-path-set will prioritise safety and abort attempts to overwrite non-object values. It also correctly prevents prototype pollution attacks.

Benchmark

$ npm i lodash.set
$ node bench.js lodash.set
85422.0864751339
$ npm i dset
$ node bench.js dset
65307.5742549896
$ node bench.js fast-path-set
63214.1385409832

Acknowledgements

Thanks to Luke Edwards, James M Snell and Simone Sanfratello for helping polishing this to perfection.

License

MIT

1.0.1

4 years ago

1.0.0

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago