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

@ts-common/json

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-common/json - npm Package Compare versions

Comparing version 0.0.21 to 0.1.0

14

index.d.ts

@@ -15,10 +15,10 @@ import { MutableStringMap, StringMap } from "@ts-common/string-map";

export interface Visitor<T> {
asNull(): T;
asBoolean(value: boolean): T;
asString(value: string): T;
asNumber(value: number): T;
asArray(value: JsonArray): T;
asObject(value: JsonObject): T;
readonly asNull: () => T;
readonly asBoolean: (value: boolean) => T;
readonly asString: (value: string) => T;
readonly asNumber: (value: number) => T;
readonly asArray: (value: JsonArray) => T;
readonly asObject: (value: JsonObject) => T;
}
export declare function visit<T>(value: Json, visitor: Visitor<T>): T;
export declare const visit: <T>(value: Json, visitor: Visitor<T>) => T;
export declare const parse: (str: string) => Json;

@@ -25,0 +25,0 @@ export declare const stringify: (json: Json) => string;

@@ -5,13 +5,10 @@ "use strict";

const _ = tslib_1.__importStar(require("@ts-common/iterator"));
function visit(value, visitor) {
return value === null ? visitor.asNull() :
typeof value === "boolean" ? visitor.asBoolean(value) :
typeof value === "string" ? visitor.asString(value) :
typeof value === "number" ? visitor.asNumber(value) :
_.isArray(value) ? visitor.asArray(value) :
visitor.asObject(value);
}
exports.visit = visit;
exports.visit = (value, visitor) => value === null ? visitor.asNull() :
typeof value === "boolean" ? visitor.asBoolean(value) :
typeof value === "string" ? visitor.asString(value) :
typeof value === "number" ? visitor.asNumber(value) :
_.isArray(value) ? visitor.asArray(value) :
visitor.asObject(value);
exports.parse = JSON.parse;
exports.stringify = JSON.stringify;
exports.isPrimitive = (value) => value === null || typeof value !== "object";
{
"name": "@ts-common/json",
"version": "0.0.21",
"version": "0.1.0",
"description": "JSON Data Type",

@@ -27,8 +27,8 @@ "main": "index.js",

"tslint": "^5.11.0",
"typescript": "^3.1.3"
"typescript": "^3.1.6"
},
"dependencies": {
"@ts-common/iterator": "^0.0.39",
"@ts-common/string-map": "^0.1.1"
"@ts-common/iterator": "^0.1.0",
"@ts-common/string-map": "^0.2.0"
}
}

@@ -1,1 +0,3 @@

# JSON Data Type
# JSON Data Type
[![Build Status](https://dev.azure.com/ts-common/ts-common/_apis/build/status/ts-common.json)](https://dev.azure.com/ts-common/ts-common/_build/latest?definitionId=9)

Sorry, the diff of this file is not supported yet

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