0.0.6 • Published 3 years ago

@jsonhero/json-infer-types-formatter v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

JSON Infer Types Formatter

You can nicely format values, with inferred or explicitly specified types (using the @jsonhero/json.infer-types package).

Installation

$ npm install --save @jsonhero/json-infer-types-formatter

Getting started

JavaScript:

const { format } = require("@jsonhero/json-infer-types-formatted");

TypeScript:

import { format } from "@jsonhero/json-infer-types-formatted";
format(1234.567); // => { simple: "1,234.567", html: "1,234.567" }
format(true); // =>  { simple: "True", html: "True" }
format(null); // =>  { simple: "Null", html: "Null" }
format([0, 1]); // =>  { simple: "[0,1]", html: "<code>[0,1]</code>" }
format({ name: "Matt" }); // =>  { simple: '{"name":"Matt"}', html: '<code>{"name":"Matt"}</code>' }
format("https://www.google.com"); // => { simple: "https://www.google.com", html: '<a href="https://www.google.com">https://www.google.com</a>' }