Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ts-typed-json
Advanced tools
Readme
This library is a set of type definitions and utilities for dealing with JSON data in a type-safe way with TypeScript.
The most important type definitions are JSON.Value
, JSON.Object
,
and JSON.Array
, which correspond respectively to JSON values,
objects, and arrays, as the names suggest.
The library also exports safely-typed versions of the standard JSON.parse()
and JSON.stringify()
functions.
import * as JSON from 'ts-typed-json';
interface JSON.Object extends Record<string, JSON.Value> {}
interface JSON.Array extends Array<JSON.Value> {}
type JSON.Value = null | boolean | number | string | JSON.Object | JSON.Array;
Tests if a JSON value is null
.
Tests if a JSON value is a boolean.
Tests if a JSON value is a number.
Tests if a JSON value is a string.
Tests if a JSON value is a JSON object.
Tests if a JSON value is a JSON array.
Casts a JSON value to null
, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a boolean, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a number, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a string, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a JSON object, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a JSON array, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Parses a source string as a JSON value.
Serializes a JSON value to a string.
Synchronously loads a JSON value from the filesystem.
Asynchronously loads a JSON value from the filesystem.
FAQs
JSON types and utilities for TypeScript.
The npm package ts-typed-json receives a total of 5,098 weekly downloads. As such, ts-typed-json popularity was classified as popular.
We found that ts-typed-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.