Gathering detailed insights and metrics for object-path-immutable
Gathering detailed insights and metrics for object-path-immutable
Gathering detailed insights and metrics for object-path-immutable
Gathering detailed insights and metrics for object-path-immutable
dot-prop-immutable
Immutable version of dot-prop with some extensions
typed-object-path-immutable
A well-typed immutable object helper library
@thi.ng/paths
Immutable, optimized and optionally typed path-based object property / array accessors with structural sharing
object-path-immutable-yolo
Modify deep object properties without modifying the original object (immutability). Works great with React and Redux.
Modify deep object properties without modifying the original object (immutability). Works great with React and Redux.
npm install object-path-immutable
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.1
Supply Chain
99.6
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
416 Stars
117 Commits
47 Forks
8 Watchers
9 Branches
24 Contributors
Updated on Jul 14, 2025
Latest Version
4.1.2
Package Id
object-path-immutable@4.1.2
Size
11.42 kB
NPM Version
7.5.2
Node Version
14.9.0
Published on
Sep 16, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Tiny JS library to modify deep object properties without modifying the original object (immutability).
Works great with React (especially when using setState()
) and Redux (inside a reducer).
This can be seen as a simpler and more intuitive alternative to the React Immutability Helpers and Immutable.js.
npm install object-path-immutable --save
The following, sets a property without modifying the original object.
It will minimize the number of clones down the line. The resulting object is just a plain JS object literal,
so be warned that it will not be protected against property mutations (like Immutable.js
)
1const obj = { 2 a: { 3 b: 'c', 4 c: ['d', 'f'] 5 } 6} 7 8const newObj = immutable.set(obj, 'a.b', 'f') 9// { 10// a: { 11// b: 'f', 12// c: ['d', 'f'] 13// } 14// } 15 16// obj !== newObj 17// obj.a !== newObj.a 18// obj.a.b !== newObj.a.b 19 20// However: 21// obj.a.c === newObj.a.c
You can also chain the api's and call value()
at the end to retrieve the resulting object.
1const newObj = immutable.wrap(obj).set('a.b', 'f').del('a.c.0').value()
1// Premises 2 3const obj = { 4 a: { 5 b: 'c', 6 c: ['d', 'f'] 7 } 8} 9 10import * as immutable from 'object-path-immutable'
Changes an object property.
1const newObj1 = immutable.set(obj, 'a.b', 'f') 2const newObj2 = immutable.set(obj, ['a', 'b'], 'f') 3 4// { 5// a: { 6// b: 'f', 7// c: ['d', 'f'] 8// } 9// } 10 11// Note that if the path is specified as a string, numbers are automatically interpreted as array indexes. 12 13const newObj = immutable.set(obj, 'a.c.1', 'fooo') 14// { 15// a: { 16// b: 'f', 17// c: ['d', 'fooo'] 18// } 19// }
Updates an object property.
1const obj = { 2 a: { 3 b: 1 4 } 5} 6 7const newObj = immutable.update(obj, ['a', 'b'], v => v + 1) 8 9// { 10// a: { 11// b: 2, 12// } 13// }
Push into a deep array (it will create intermediate objects/arrays if necessary).
1const newObj = immutable.push(obj, 'a.d', 'f') 2// { 3// a: { 4// b: 'f', 5// c: ['d', 'f'], 6// d: ['f'] 7// } 8// }
Deletes a property.
1const newObj = immutable.del(obj, 'a.c') 2// { 3// a: { 4// b: 'f' 5// } 6// }
Can also delete a deep array item using splice
1const newObj = immutable.del(obj, 'a.c.0') 2// { 3// a: { 4// b: 'f', 5// c: ['f'] 6// } 7// }
Shallow copy properties.
1const newObj = immutable.assign(obj, 'a', { b: 'f', g: 'h' }) 2// { 3// a: { 4// b: 'f', 5// c: ['d, 'f'], 6// g: 'h' 7// } 8// }
Insert property at the specific array index.
1const newObj = immutable.insert(obj, 'a.c', 'k', 1) 2// var obj = { 3// a: { 4// b: 'c', 5// c: ['d, 'k' 'f'], 6// } 7// }
Deep merge properties.
1const newObj = immutable.merge(obj, 'a.c', {b: 'd'})
Retrieve a deep object property. Imported from object-path for convenience.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 6/25 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More