@solana/fast-stable-stringify
Advanced tools
Comparing version 2.0.0-preview.2 to 2.0.0-preview.2.20240417112348.42e80e05b94e649b7921049b531abab2bf637347
@@ -22,3 +22,3 @@ // src/index.ts | ||
return null; | ||
} else if (val.toJSON && typeof val.toJSON === "function") { | ||
} else if ("toJSON" in val && typeof val.toJSON === "function") { | ||
return stringify(val.toJSON(), isArrayProp); | ||
@@ -25,0 +25,0 @@ } else { |
@@ -22,3 +22,3 @@ // src/index.ts | ||
return null; | ||
} else if (val.toJSON && typeof val.toJSON === "function") { | ||
} else if ("toJSON" in val && typeof val.toJSON === "function") { | ||
return stringify(val.toJSON(), isArrayProp); | ||
@@ -25,0 +25,0 @@ } else { |
@@ -22,3 +22,3 @@ // src/index.ts | ||
return null; | ||
} else if (val.toJSON && typeof val.toJSON === "function") { | ||
} else if ("toJSON" in val && typeof val.toJSON === "function") { | ||
return stringify(val.toJSON(), isArrayProp); | ||
@@ -25,0 +25,0 @@ } else { |
{ | ||
"name": "@solana/fast-stable-stringify", | ||
"version": "2.0.0-preview.2", | ||
"version": "2.0.0-preview.2.20240417112348.42e80e05b94e649b7921049b531abab2bf637347", | ||
"description": "Deterministic stringification for when performance and bundle size matters", | ||
@@ -61,2 +61,4 @@ "exports": { | ||
"compile:js": "tsup --config build-scripts/tsup.config.package.ts", | ||
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node ../../node_modules/@solana/build-scripts/add-js-extension-to-types.mjs", | ||
"dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch", | ||
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-preview} --access public --no-git-checks", | ||
@@ -70,5 +72,6 @@ "publish-packages": "pnpm prepublishOnly && pnpm publish-impl", | ||
"test:treeshakability:node": "agadoo dist/index.node.js", | ||
"test:unit:browser": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --silent", | ||
"test:unit:node": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --silent" | ||
"test:typecheck": "tsc --noEmit", | ||
"test:unit:browser": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent", | ||
"test:unit:node": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent" | ||
} | ||
} |
@@ -10,3 +10,3 @@ # fast-stable-stringify | ||
```javascript | ||
var stringify = require('fast-stable-stringify'); | ||
import stringify from '@solana/fast-stable-stringify'; | ||
stringify({ d: 0, c: 1, a: 2, b: 3, e: 4 }); // '{"a":2,"b":3,"c":1,"d":0,"e":4}' | ||
@@ -17,12 +17,11 @@ ``` | ||
* handle all variations of all basic javascript values (number, string, boolean, array, object, null, Date, BigInt) | ||
* handle undefined _and_ function in the same way as `JSON.stringify` | ||
* **not support ie8 (and below) with complete certainty**. | ||
- handle all variations of all basic javascript values (number, string, boolean, array, object, null, Date, BigInt) | ||
- handle undefined _and_ function in the same way as `JSON.stringify` | ||
- **not support ie8 (and below) with complete certainty**. | ||
Unlike substack's, it does: | ||
* not implement the 'replacer' or 'space' arguments of the JSON.stringify method | ||
* not check for circular references | ||
- not implement the 'replacer' or 'space' arguments of the JSON.stringify method | ||
- not check for circular references | ||
## Running tests | ||
@@ -32,3 +31,3 @@ | ||
npm run test:unit:browser | ||
npm run test:unit:node | ||
``` | ||
npm run test:unit:node | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
37576
15
379