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

xtrajson

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xtrajson - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

1

dist/index.d.ts
type Transformer<T, S> = {
name: string;
key: string;
isApplicable(value: unknown): value is T;

@@ -4,0 +5,0 @@ serialize(value: T): S;

25

dist/index.js

@@ -75,3 +75,4 @@ "use strict";

u: {
name: "u",
name: "Unknown",
key: "u",
isApplicable(value) {

@@ -88,3 +89,4 @@ return value === void 0;

i: {
name: "i",
name: "BigInt",
key: "i",
isApplicable(value) {

@@ -101,3 +103,4 @@ return typeof value === "bigint";

b: {
name: "b",
name: "Buffer",
key: "b",
isApplicable(value) {

@@ -114,3 +117,4 @@ return value instanceof import_buffer.Buffer;

d: {
name: "d",
name: "Date",
key: "d",
isApplicable(value) {

@@ -138,3 +142,3 @@ return value instanceof Date;

return {
[`${MAGIC}${transformer.name}`]: transformer.serialize(value)
[`${MAGIC}${transformer.key}`]: transformer.serialize(value)
};

@@ -179,3 +183,7 @@ }

register(transformer) {
__privateGet(this, _transformers)[transformer.name] = transformer;
const existing = __privateGet(this, _transformers)[transformer.key];
if (existing) {
throw new Error(`Transformer ${transformer.key} already registered for '${existing.name}'`);
}
__privateGet(this, _transformers)[transformer.key] = transformer;
}

@@ -192,8 +200,5 @@ stringify(data) {

);
if (value instanceof Date) {
console.log(key, value, transformer);
}
if (transformer) {
return {
[`${MAGIC}${transformer.name}`]: transformer.serialize(value)
[`${MAGIC}${transformer.key}`]: transformer.serialize(value)
};

@@ -200,0 +205,0 @@ }

{
"name": "xtrajson",
"version": "1.0.0",
"version": "1.0.1",
"description": "A JSON serialization tool",

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

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