1.0.3 • Published 2 years ago

js-parse-key-value v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Parse Key Value

  • For parsing simple key value pairs.
  • Keys and values do not have to be quoted like JSON.
  • Keys and values can be quoted to include whitespace in the token.

Usage

import parse from "js-parse-key-value";

const ex1 = parse("key: value");
// ex1 is {key: "value"}
const ex2 = parse("key=value", { delimiter: "=" });
// ex2 is {key: "value"}
const ex3 = parse('"quoted key": "quoted value"');
// ex3 is {"quoted key": "quoted value"}

// IFS option must be a regular expression.
const ex4 = parse("a: 1, b: 2", { IFS: /[\s,]+/ });
// ex3 is { a: 1, b: 2 }
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago