Skip to content

NickKelly1/nkp-kv

Repository files navigation

@nkp/kv

npm version deploy status known vulnerabilities

Zero-dependency NodeJS utility to stringify the key-value pairs of an object.

import { kv } from '@nkp/kv';

// hello="word"  library="@nkp/kv"
kv({ hello: 'world', library: '@nkp/kv' });

// you map change the default key formatting
// this can be used to add colors

// __hello__="word"  __library__="@nkp/kv"
kv({ hello: 'world', library: '@nkp/kv' }, { formatKey: (key) => `__${key}__`, });

// change formatKey for all calls
kv.defaults.formatKey = (key) => `__${key}__`;

// __hello__="word"  __library__="@nkp/kv"
kv({ hello: 'world', library: '@nkp/kv' });

Table of contents

Installation

npm

npm install @nkp/kv

yarn

yarn add @nkp/kv

pnpm

pnpm add @nkp/kv

Exports

@nkp/kv targets CommonJS and ES modules. To utilise ES modules consider using a bundler like webpack or rollup.

Updating dependencies

To update dependencies run one of

# if npm
# update package.json
npx npm-check-updates -u
# install
npm install

# if yarn
# update package.json
yarn create npm-check-updates -u
# install
yarn

# if pnpm
# update package.json
pnpx npm-check-updates -u
# install
pnpm install

Publishing

To a release a new version:

  1. Update the version number in package.json
  2. Push the new version to the master branch on GitHub
  3. Create a new release on GitHub for the latest version

This will trigger a GitHub action that tests and publishes the npm package.

About

Zero-dependency NodeJS utility to stringify the key-value pairs of an object.

Resources

License

Stars

Watchers

Forks

Packages

No packages published