parse-json-object
Parse a typed JSON object.
Last updated 6 years ago by bconnorwhite .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install parse-json-object 
SYNC missed versions from official npm registry.

parse-json-object

NPM TypeScript Coverage Status GitHub Stars Twitter Follow

Parse a typed JSON object.

  • Returns undefined if unable to parse
  • Returns typed JSON object if successful

Installation

yarn add parse-json-object
npm install parse-json-object

API

Types

import parse, {
  parseJSONValue,
  parseJSONObject,
  parseJSONArray,
  parseString,
  JSONValue,
  JSONObject,
  JSONValue,
  JSONArray
} from "parse-json-object";

function parse<T extends JSONValue>(value: string | undefined, isType: (value: T) => boolean): T | undefined;

function parseJSONValue<T extends JSONValue>(value?: string): T | undefined;

function parseJSONObject<T extends JSONObject>(value?: string): T | undefined;

function parseJSONArray<T extends JSONArray>(value?: string): T | undefined;

function parseString<T extends string>(value?: string): T | undefined;

type JSONValue = string | number | boolean | null | JSONObject | JSONArray;

type JSONObject = {
  [key in string]?: JSONValue
};

interface JSONArray extends Array<JSONValue> {};

Dependenciesdependencies


Dev DependenciesDavid


License license

MIT


Related Packages:

Current Tags

  • 2.0.1                                ...           latest (6 years ago)

10 Versions

  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.6                                ...           6 years ago
  • 1.0.5                                ...           6 years ago
  • 1.0.4                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 0
Dependencies (1)
Dev Dependencies (2)

Copyright 2013 - present © cnpmjs.org | Home |