chain-filler

1.0.1 • Public • Published

chain-filler

If you want to fill your objects in one beautiful line + have validation, you should use chain-filler.

Installation

$ yarn add chain-filler
// or
$ npm i chain-filler

Usage

Basic usage without validation:

import chainFiller from 'chain-filler';

const opts = chainFiller(['title', 'name', 'lastName']);

console.log(opts.title('chain-filler').name('Evan').lastName('You').get());

Usage with validation:

import chainFiller from 'chain-filler';

const opts = chainFiller({
  title: () => true,
  name: (name) => name !== 'Evan',
  lastName: (lastName) => lastName !== 'Abramov',
});

console.log(opts.title('chain-filler').name('Evan').lastName('You').get());  // Validation Error: Evan cannot be inserted inside name.

Readme

Keywords

none

Package Sidebar

Install

npm i chain-filler

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

11 kB

Total Files

12

Last publish

Collaborators

  • pmzi