![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@digitregroup/object-mapper
Advanced tools
Makes object-to-object transformation easy.
const sourceObject = {
fabfour: { user_count: 4 },
user: [
{
first: 'John',
last: 'Lennon',
instruments: [
{ name: 'Guitar', colour: 'Red' },
{ name: 'Bass guitar', colour: 'Blue' }
]
},
{
first: 'Paul',
last: 'McCartney',
picture: ['picture0.jpg', 'picture1.png', 'picture2.gif' ]
},
{ first: 'George', last: 'Harrison' },
{ first: 'Ringo', last: 'Starr' }
]
};
const mapping = {
'ringo.last_name': 'user[first=Ringo].last',
'paul.pictures': 'user.1.picture[]',
'john.bass.colour': 'user.0.instruments.1.colour',
'amount_of_band_members': 'fabfour.user_count',
};
const result = ObjectMapper.mapItem(sourceObject, mapping);
//{
// "ringo": {
// "last_name": "Starr"
// },
// "paul": {
// "pictures": [
// "picture0.jpg",
// "picture1.png",
// "picture2.gif"
// ]
// },
// "john": {
// "bass": {
// "colour": "Blue"
// }
// },
// "amount_of_band_members": 4
//}
Dot notation matching
ObjectMapper.mapItem (
{parent: {child: {value: 'bar'}}},
{result: 'parent.child.value'}
);
// {"result":"bar"}
Query matching
ObjectMapper.mapItem (
{
children: [
{name: 'foo', value: 'bar'},
{name: 'baz', value: 'biz'}
]
},
{result: 'children[name=baz].value'}
);
// {"result":"biz"}
Data transformation
ObjectMapper.mapItem (
{
user: {
name: 'lennon',
firstname: 'john'
}
},
{
'result': [
'user.name',
name => name.toUpperCase(),
uppername => uppername.split('')
]
}
);
// {"result":["L","E","N","N","O","N"]}
Dot notation object conversion
ObjectMapper.mapItem (
{foo: 'bar'},
{'target.name.can.be.anything.0': 'foo'}
);
// {"target":{"name":{"can":{"be":{"anything":["bar"]}}}}}
npm install --save @digitregroup/object-mapper
Package | Version | Dev |
---|---|---|
flat | ^4.1.0 | ✖ |
chai | ^4.2.0 | ✔ |
cross-env | ^5.2.0 | ✔ |
laravel-mix | ^4.0.14 | ✔ |
mocha | ^6.0.2 | ✔ |
nyc | ^13.3.0 | ✔ |
vue-template-compiler | ^2.6.7 | ✔ |
Contributions welcome; Please submit all pull requests against the develop branch. If your pull request contains JavaScript patches or features, you should include relevant unit tests. Thanks!
DigitRE Group
FAQs
Makes object-to-object transformation easy.
The npm package @digitregroup/object-mapper receives a total of 3 weekly downloads. As such, @digitregroup/object-mapper popularity was classified as not popular.
We found that @digitregroup/object-mapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.