Gathering detailed insights and metrics for property-expr-csp
Gathering detailed insights and metrics for property-expr-csp
Gathering detailed insights and metrics for property-expr-csp
Gathering detailed insights and metrics for property-expr-csp
tiny util for getting and setting deep object props safely
npm install property-expr-csp
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
17 Commits
3 Watchers
1 Branches
9 Contributors
Updated on Jul 11, 2018
Latest Version
1.4.0
Package Id
property-expr-csp@1.4.0
Unpacked Size
29.25 kB
Size
8.72 kB
File Count
9
NPM Version
5.6.0
Node Version
8.11.1
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
No dependencies detected.
Tiny expression helper for creating accessors; handles most stuff, including ["bracket notation"] for property access. Originally based off of Kendo UI Core expression code and the original property-expr package, but here is special version to satisfy CSP (Content-Security-Policy) requirements!
npm install property-expr-csp
Setters and getters are not compiled to functions and executed every time to satisfy CSP
var expr = require('property-expr')
, obj = {
foo: {
bar: [ "hi", { buz: { baz: 'found me!' } }]
}
};
var getBaz = expr.getter('foo.bar[1]["buz"].baz')
, setBaz = expr.setter('foo.bar[1]["buz"].baz')
console.log(getBaz(obj)) // => 'found me!'
setBaz(obj, 'set me!')
console.log(obj.foo.bar[1].buz.baz) // => 'set me!'
getter(expression, [ safeAccess ])
Returns a function that accepts an obj and returns the value at the supplied expression. You can create a "safe" getter, which won't error out when accessing properties that don't exist, reducing existance checks befroe property access:
expr.getter('foo.bar.baz', true)({ foo: {} }) // => undefined
//instead of val = foo.bar && foo.bar.baz
setter(expression)
Returns a function that accepts an obj and a value and sets the property pointed to by the expression to the supplied value.
expr(expression, [ safeAccess], [ paramName = 'data'])
Method was removed, because it makes no sense in CSP version.
split(path) -> Array
Returns an array of each path segment.
1 split("foo['bar'][0].baz") // [ "foo", "'bar'", "0", "baz"]
forEach(path, iterator[, thisArg])
Iterate through a path but segment, with some additional helpful metadata about the segment. The iterator function is called with: pathSegment
, isBracket
, isArray
, idx
, segments
1.forEach('foo["bar"][1]', function(pathSegment, isBracket, isArray, idx, segments) { 2 // 'foo' -> isBracket = false, isArray = false, idx = 0 3 // '"bar"' -> isBracket = true, isArray = false, idx = 1 4 // '0' -> isBracket = false, isArray = true, idx = 2 5}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
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