
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@lpi/dataobject-parser
Advanced tools
A nodejs module designed to parse an Object hash transposing between dot-notation and a structured heirarchy of Objects/Arrays.
A nodejs module designed to parse an Object hash transposing between dot-notation and a structured heirarchy of Objects/Arrays.
String programming should be avoided.
This module generally exists as a quick work around. We original developed it to store our MongoDb documents in Backbone.js models. Our Backbonejs.model dispatched events from data in a complex hierarchal structure.
Using this tool simplified our models so that we could just use one model with the subdocuments laid out in a hash with dot-notation. In our application we've overwritten the Backbonejs.sync to parse the data before sending/receiving.
$ npm install dataobject-parser
Instantiate a new instance of DataObjectParser to manage an object:
var d = new DataObjectParser();
Set using dot-notation:
d.set("caravan.personel.leader","Travis");
d.set("caravan.personel.cook","Brent");
Also set using array notation:
d.set("location.rooms[0]", "kitchen");
d.set("location.rooms[1]", "bathroom");
The Object returned should be the equivalent structured object:
var obj = d.data();
That is, where obj is equivalent to:
var obj = {
caravan:{
personel:{
leader: "Travis",
cook: "Brent"
}
},
location: {
rooms: ["kitchen", "bathroom"]
}
};
transpose() and untranspose() methods can transform the data between the two formats (e.g. - An Object hash with properties using dot-notation and a heirchy structured Object or Object(s)/Arrays(s))
flat = DataObjectParser.untranspose(structured)
structured = DataObjectParser.transpose(flat)
Where the equivalent results would be:
var structured = {
location: {
city:{
name: "House on cliff",
geo: '45, 23'
}
},
time: {
hour: '0',
minute: '0'
},
duration: '4 hours',
record: 'Beetles'
};
var flat = {
'location.city.name': 'House on cliff',
'location.city.geo': '45, 23',
'time.hour': '0',
'time.minute': '0',
duration: '4 hours',
record: 'Beetles'
};
Please take a look at the test: test/utils-dataobject-parser.js for more code examples.
The MIT License (MIT)
Copyright (c) 2014 Gigzolo Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A nodejs module designed to parse an Object hash transposing between dot-notation and a structured heirarchy of Objects/Arrays.
The npm package @lpi/dataobject-parser receives a total of 30 weekly downloads. As such, @lpi/dataobject-parser popularity was classified as not popular.
We found that @lpi/dataobject-parser 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.