cosmosio / nested-property Goto Github PK
View Code? Open in Web Editor NEWRead or write an array or object's nested property via a string like 'my.nested.property'
License: Other
Read or write an array or object's nested property via a string like 'my.nested.property'
License: Other
If I have an array:
{
emails: [
{
path1: "a",
delPath: "[email protected]"
},
{
path1: "b",
delPath: "[email protected]"
},
...
]
}
I think it would be useful to be able to use wildcards like the following:
nestedProperty.set(obj, 'emails.*.delPath', undefined)
OR
nestedProperty.set(obj, 'emails.$.delPath', undefined)
Which would essentially grab all items in the array and end up like this
{
emails: [
{
path1: "a",
delPath: undefined
},
{
path1: "b",
delPath: undefined
},
...
]
}
Great library, thanks. Is there a way to delete a nested property?
Example:
const x = {
'one': 1,
'two': 2,
'three': {
'one': 1,
'two': 2,
'three': [
{
'one': 1
},
{
'one': 'ONE'
},
{
'one': 'I'
}
]
},
'four': [0, 1, 2]
};
console.log(np.get(x, 'three.three[0].one'));
Hi, wondering if you'd consider adding a changelog or release notes, so one could track changes in an easier manner. This would make it easier to upgrade versions of nested-property as you could most likely list breaking changes in the notes as well.
What do you think?
We should be able to use negative indexes when setting/getting array values to calculate the position from the end of the array. For example, -1 would be the last item in the array. I tried doing this but it doesn't seem to work currently.
Hello,
want to publish the package to company artifactory but license check fails even the 'licenses' key are set in package.json. Noticed, package's npm profile show NONE for license.I guess that npm doesn't recognize the 'licenses' key in the package.json.
Changing the key to: "license": "MIT" would possibly solve this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.