object-values-cleaner

0.0.6 • Public • Published

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
// }

/object-values-cleaner/

    Package Sidebar

    Install

    npm i object-values-cleaner

    Weekly Downloads

    0

    Version

    0.0.6

    License

    MIT

    Unpacked Size

    193 kB

    Total Files

    7

    Last publish

    Collaborators

    • crowder91