@ts-common/json
Advanced tools
Comparing version
@@ -25,8 +25,9 @@ import { MutableStringMap, StringMap } from "@ts-common/string-map"; | ||
export declare const stringify: (json: Json) => string; | ||
export declare type NonUndefined<T> = T extends undefined ? never : T; | ||
export declare type Property<T, K extends keyof T> = NonUndefined<T[K]>; | ||
export declare const isPrimitive: (value: string | number | boolean | object | null) => value is JsonPrimitive; | ||
export declare const isObject: (value: string | number | boolean | object | null) => value is JsonObject; | ||
export declare const isPrimitive: (value: Json) => value is JsonPrimitive; | ||
export declare const isObject: (value: Json) => value is JsonObject; | ||
export declare type JsonType = "null" | "boolean" | "string" | "number" | "object" | "array"; | ||
export declare const typeOf: (value: Json) => JsonType; | ||
export declare type EmptyObject = { | ||
readonly [k in never]?: never; | ||
}; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@ts-common/json", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"description": "JSON Data Type", | ||
@@ -46,7 +46,7 @@ "main": "dist/index.js", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^10.12.11", | ||
"@types/node": "^10.12.12", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.1.0", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.2.1" | ||
"typescript": "^3.2.2" | ||
}, | ||
@@ -53,0 +53,0 @@ "dependencies": { |
@@ -45,10 +45,6 @@ import * as _ from "@ts-common/iterator" | ||
export type NonUndefined<T> = T extends undefined ? never : T | ||
export type Property<T, K extends keyof T> = NonUndefined<T[K]> | ||
export const isPrimitive = (value: JsonPrimitive|object): value is JsonPrimitive => | ||
export const isPrimitive = (value: Json): value is JsonPrimitive => | ||
value === null || typeof value !== "object" | ||
export const isObject = (value: JsonPrimitive|object): value is JsonObject => | ||
export const isObject = (value: Json): value is JsonObject => | ||
value !== null && typeof value === "object" && !_.isArray(value) | ||
@@ -70,1 +66,3 @@ | ||
) | ||
export type EmptyObject = { readonly [k in never]?: never } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20214
-1.62%