Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@arg-def/dot-notation
Advanced tools
Object readings and transformations using dot notation syntax
Object readings and transformations using dot notation syntax
Play around with dot-notation and experience the magic!
npm install @arg-def/dot-notation --save
#or
yarn add @arg-def/dot-notation
import dot from '@arg-def/dot-notation';
const source = {
person: {
name: {
firstName: 'John',
lastName: 'Doe'
},
address: [
{
street: 'Infinite Loop',
city: 'Cupertino',
state: 'CA',
postalCode: 95014,
country: 'United States'
},
]
}
};
dot.pick('person.name', source);
//outputs { firstName: 'John', lastName: 'Doe' }
dot.pick('person.address[0].street', source);
//outputs "Infinite Loop"
import dot from '@arg-def/dot-notation';
const source = {
'person.name.firstName': 'John',
'person.name.lastName': 'Doe',
'person.address[].street': 'Infinite Loop',
'person.address[].city': 'Cupertino',
'person.address[].postalCode': 95014,
};
dot.parse(source);
/* outputs
{
person: {
name: {
firstName: 'John',
lastName: 'Doe',
},
address: [
{
street: 'Infinite Loop',
city: 'Cupertino',
postalCode: 95014,
},
],
},
}
*/
import dot from '@arg-def/dot-notation';
const source = {
'person.name.firstName': 'John',
'person.name.lastName': 'Doe',
'person.address[0].street': 'Infinite Loop',
'person.address[0].city': 'Cupertino',
'person.address[0].postalCode': 95014,
'person.address[1].street': '1600 Amphitheatre',
'person.address[1].city': 'Mountain View',
'person.address[1].postalCode': 94043,
};
dot.parse(source);
/* outputs
{
person: {
name: {
firstName: 'John',
lastName: 'Doe',
},
address: [
{
street: 'Infinite Loop',
city: 'Cupertino',
postalCode: 95014,
},
{
street: 'g1600 Amphitheatre',
city: 'Mountain View',
postalCode: 94043,
},
],
},
}
*/
import dot from '@arg-def/dot-notation';
const source = 'person.name';
const value = 'John Doe';
dot.parseKey(source, value);
/* outputs
{
person: {
name: 'John Doe',
},
}
*/
FAQs
Object readings and transformations using dot notation syntax
The npm package @arg-def/dot-notation receives a total of 7 weekly downloads. As such, @arg-def/dot-notation popularity was classified as not popular.
We found that @arg-def/dot-notation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.