Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

jssn

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jssn - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+1
-1
component.json

@@ -5,3 +5,3 @@ {

"description": "JavaScript Super Notation (JSON + circular refs + dates + (optional)functions)",
"version": "0.0.3",
"version": "0.0.4",
"keywords": [],

@@ -8,0 +8,0 @@ "dependencies": {

@@ -83,2 +83,5 @@ function type(val){

function encodeObject(from, to, circular) {
if (from.constructor != Object) {
to['_jssn_proto'] = /^function([^\(]+)\(/.exec(from.constructor.toString())[1].trim();
}
var k = keys(from);

@@ -102,3 +105,3 @@ for (var i = 0; i < k.length; i++) {

function parse(str) {
function parse(str, constructors) {
var source = JSON.parse(str).map(function (o, i) {

@@ -116,7 +119,10 @@ if (type(o) === 'array') {

decoded: false,
original: {}
original: o['_jssn_proto'] && constructors[o['_jssn_proto']] ?
Object.create(constructors[o['_jssn_proto']].prototype)
: {}
};
}
if (type(o) === 'string' && i != 0) {
var parsed = /^function [^\(]*\(([^\)]*)\) \{(.*)\}$/.exec(o);
var parsed = /^function[^\(]*\(([^\)]*)\) ?\{((?:\n|\r|.)*)\}$/.exec(o);
if (!parsed) console.log(JSON.stringify(o));
var args = parsed[1].split(',')

@@ -126,3 +132,3 @@ .map(function (a) { return a.trim(); })

args.push(parsed[2]);
return new Function(args);
return Function.apply(null, args);
} else {

@@ -129,0 +135,0 @@ return {encoded: o, decoded: false, original: null};

{
"name": "jssn",
"version": "0.0.3",
"version": "0.0.4",
"description": "JavaScript Super Notation (JSON + circular refs + dates + (optional)functions)",

@@ -5,0 +5,0 @@ "main": "index.js",