1.0.4 • Published 5 years ago

@pallab.gain/lazy-filter v1.0.4

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

Lazy Filter

Build Status Coverage Status

Remove or filter out value, or list of values from JSON object lazily.

Install package

npm install @pallab.gain/lazy-filter

How to use the library

const user = {
  "firstName" :  "Pallab",
  "lastName" :  "Gain",
  "email" : "example@mail.com",
  "password": "my secrect password",
  "id": "my-secret-id"
}

Nodejs/react like example

// initialize
const {
  omit,
  pick
} = require('@pallab.gain/lazy-filter');

// user object filter
const filteredUser = omit(user, ["password","id","email"])
const filteredUser = pick(user, ["password","id","email"])

Browser example

// add the library in your html
<script src="/dist/lazyfilter.js"></script>

// user object filtering
const omitedUser = LazyFilter.omit(user, ["password","id","email"])
const pickedUser = LazyFilter.pick(user, ["password","id","email"])

Install devependecies and build library

  • Install dependencies

    npm install

  • Build non-minified version of the library

    npm run build-dev

  • Build library and use in production

    npm run build-prod

    You will find the library in dist folder

  • Update or generate api doc

    npm run generate-doc

  • Run tests

    npm run test

API Doc