Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Easily stringify and parse any object including objects with circular references, using the familar parse
and stringify
methods.
var jsan = require('jsan');
var obj = {};
obj['self'] = obj;
obj['sub'] = {};
obj['sub']['subSelf'] = obj['sub'];
var str = jsan.stringify(obj);
str === '{"self":{"$ref":"$"},"sub":{"subSelf":{"$ref":"[\\"sub\\"]"}}}'; // true
var obj2 = jsan.parse(str);
obj2 === obj2['self']; // true
obj2['sub']['subSelf'] === obj2['sub']; // true
Now with 100% less eval
!
This ulitilty has been heavily optimized and performs as well as the native JSON.parse
and JSON.stringify
. It doesn't by default handle self references (non-circular) when stringifing but you can tell check by passing in true as a forth param:
var obj = {};
var subObj = {};
obj.a = subObj;
obj.b = subObj;
var str1 = jsan.stringify(obj) // '{"a":{},"b":{}}'
var str2 = jsan.stringify(obj, null, null, true) // '{"a":{},"b":{"$ref":"[\\"a\\"]"}}'
FAQs
handle circular references when stringifying and parsing
The npm package jsan receives a total of 57,692 weekly downloads. As such, jsan popularity was classified as popular.
We found that jsan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.