Socket
Socket
Sign inDemoInstall

superjson

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superjson - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

6

History.md
0.0.6 / 2016-05-11
==================
* fix test for node 6.0.0
* fix package for regexps
0.0.5 / 2016-01-22

@@ -3,0 +9,0 @@ ==================

11

index.js

@@ -16,3 +16,3 @@ /**

var rdate = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var rregexp = /^\/|\/([gimy]*)$/g;
var rregexp = /^\/([^\/]+)\/([gimy]*)$/;

@@ -113,5 +113,8 @@ /**

function stor(str) {
var i = str.lastIndexOf('/');
var flags = str.slice(i + 1);
return new RegExp(str.slice(1, i), flags);
var m = str.match(rregexp)
try {
return new RegExp(m[1], m[2])
} catch (e) {
return str
}
}

@@ -118,0 +121,0 @@

{
"name": "superjson",
"version": "0.0.5",
"version": "0.0.6",
"description": "extends JSON.stringify and JSON.parse to support additional JS types (Dates, RegExps, Functions, etc.)",

@@ -12,3 +12,3 @@ "keywords": [],

"dependencies": {
"acorn": "^0.11.0",
"acorn": "^3.1.0",
"component-type": "^1.1.0",

@@ -15,0 +15,0 @@ "json3": "^3.3.2"

@@ -23,8 +23,9 @@ /**

it('it should stringify undefined values', function() {
var str = json.parse('["undefined"]')
assert.deepEqual(str, [undefined])
it('it should parse undefined arrays', function() {
var str = json.parse('["undefined", 1]')
assert.equal(str[0], undefined)
assert.equal(str[1], 1)
})
it('should parse undefined values', function() {
it('should parse undefined objects', function() {
var obj = json.parse('{ "name": "undefined" }')

@@ -50,2 +51,14 @@ assert.equal(typeof obj.name, 'undefined')

})
it('should ignore regexp-like expressions', function() {
assert.equal(json.parse('/hi'), '/hi')
})
it('should handle regexp', function() {
assert.equal(json.parse('/^^hi/g').source, '^^hi')
})
it('should handle regexp errors', function() {
assert.equal(json.parse('/[\\\]/'), '/[\\]/')
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc