parse-key-value-pair
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

parse-key-value-pair

Parse a string like KEY=value into [key, value]

Installation

npm:

npm install --save parse-key-value-pair

yarn:

yarn add parse-key-value-pair

Usage

import parseKeyValue from 'parse-key-value-pair'

const [key, value] = parseKeyValue('NODE_ENV=production')

API

parseKeyValuePair(input) => [key, value]

Returns the parsed key and value

parseKeyValuePair(input, { ignoreMalformed: true }) => [key, value] | null

Returns the parsed key and value, returns null for malformed strings like "" and =

Readme

Keywords

none

Package Sidebar

Install

npm i parse-key-value-pair

Weekly Downloads

80

Version

2.0.1

License

MIT

Unpacked Size

2.3 kB

Total Files

4

Last publish

Collaborators

  • albinekb