Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

devalue

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devalue - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

5

package.json
{
"name": "devalue",
"description": "Gets the job done when JSON.stringify can't",
"version": "4.0.1",
"version": "4.1.0",
"repository": "Rich-Harris/devalue",
"exports": {
".": {
"types": "./types/index.d.ts",
"import": "./index.js",
"types": "./types/index.d.ts"
"default": "./index.js"
}

@@ -11,0 +12,0 @@ },

1

README.md

@@ -157,2 +157,3 @@ # devalue

- [arson](https://github.com/benjamn/arson) by Ben Newman. The `stringify`/`parse` approach in `devalue` was inspired by `arson`
- [oson](https://github.com/KnorpelSenf/oson) by Steffen Trog
- [tosource](https://github.com/marcello3d/node-tosource) by Marcello Bastéa-Forte

@@ -159,0 +160,0 @@ - [serialize-javascript](https://github.com/yahoo/serialize-javascript) by Eric Ferraiuolo

@@ -17,9 +17,14 @@ import {

if (typeof parsed === 'number') return hydrate(parsed);
if (typeof parsed === 'number') return hydrate(parsed, true);
if (!Array.isArray(parsed) || parsed.length === 0) {
throw new Error('Invalid input');
}
const values = /** @type {any[]} */ (parsed);
const hydrated = Array(values.length);
/** @param {number} index */
function hydrate(index) {
function hydrate(index, standalone = false) {
if (index === UNDEFINED) return undefined;

@@ -31,2 +36,4 @@ if (index === NAN) return NaN;

if (standalone) throw new Error(`Invalid input`);
if (index in hydrated) return hydrated[index];

@@ -33,0 +40,0 @@

@@ -33,10 +33,10 @@ import {

if (counts.has(thing)) {
counts.set(thing, counts.get(thing) + 1);
return;
}
if (!is_primitive(thing)) {
if (counts.has(thing)) {
counts.set(thing, counts.get(thing) + 1);
return;
}
counts.set(thing, 1);
counts.set(thing, 1);
if (!is_primitive(thing)) {
const type = get_type(thing);

@@ -43,0 +43,0 @@

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