set-js-object

1.0.2 • Public • Published

set-js-object

Create a JS Object (object literal) by given a key and a value

Build StatusCode Coverage 100%ISC License

API

var setObject = require('set-js-object')

setObject(key:string, value)

Return

  • a js object
  • undefined if the key is undefined

Usage

var setObject = require('set-js-object');
 
var obj = setObject('key', {a: 1});
// obj = {key: {a: 1}}
 
var singleObj = setObject('fruit', 'berry');
// singleObj = {fruit: berry}

Development

this projet has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit

to run test

npm test

to run jshint

npm run jshint

to run code style

npm run code-style

to run check code coverage

npm run check-coverage

to open the code coverage report

npm run open-coverage

Package Sidebar

Install

npm i set-js-object

Weekly Downloads

0

Version

1.0.2

License

ISC

Last publish

Collaborators

  • quim