Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@jswork/str2kv

afeiship34MIT1.0.1TypeScript support: included

String to kv obj.

map, obj, string, transform

readme

str2kv

String to kv obj.

version license size download

installation

npm install @jswork/str2kv

usage

import str2kv from '@jswork/str2kv';

// default saparator is [:/@]
const kmstr1 = '1id:value; 2id:value2; 3id:value3';
const obj1 = str2kv(km2str);
// { '1id': 'value', '2id': 'value2', '3id': 'value3' }

// custom saparator
const kmstr2 = '1id:value; 2id:value2; 3id:value3';
const obj2 = str2kv(km2str, ':');
// { '1id': 'value', '2id': 'value2', '3id': 'value3' }

license

Code released under the MIT license.