
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Hierarchy expressed by the indent is converted into the JavaScript object.
$ npm install indent2obj
$ bower install indent2obj
<script type="text/javascript" src="indent2obj.js"></script>
input
looks like this.
depth1
depth2
depth2
depth3
depth1
depth1
dpeth2
The result is as follows.
var results = indent2obj(input);
console.log(results);
/*
[
{
name: "depth1",
children: [
{
name: "depth2",
children: []
},
{
name: "depth2",
children: [
{
name: "depth3",
children: []
}
]
}
]
},
{
name: "depth1",
children: []
},
{
name: "depth1",
children: [
{
name: "depth2",
children: []
}
]
}
]
*/
The default is to use 2 spaces.
If you want to the tab, Do the following.
indent2obj(input, "\t");
In the case of the 4 spaces.
indent2obj(input, " ");
indent2obj.defaultIndent = " ";
indent2obj.keys = {
name: "name",
children: "children"
};
Released under the MIT Licence
FAQs
Hierarchy expressed by the indent is converted into the JavaScript object.
The npm package indent2obj receives a total of 1 weekly downloads. As such, indent2obj popularity was classified as not popular.
We found that indent2obj 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.