0.0.6 • Published 5 years ago

object-values-cleaner v0.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

object-values-cleaner

A simple script to clean the values of an object.

It cleans a given object with the following behaviour
Key   -> sets the values to null
Array -> If Array of Objects: sets array size to 1 and all object keys to null
         If Array of Elements: sets array size to 0

Getting Started

# via yarn
yarn add object-values-cleaner

# via npm
npm install --save object-values-cleaner

Usage

// es5
var cleanObject = require("object-values-cleaner");
// es6
import cleanObject from "object-values-cleaner";

const obj = {
  foo: "foo",
  bar: "bar"
};

const cleanedObj = cleanObject(obj);

console.log(cleanedObj);

// Should produce the following output
// {
//    foo: null,
//    bar: null
// }