@nanomatic/object_filter
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Object filter

@nanomatic/object_filter

Status License


Library that allows filtering the object by passed regular expressions

📝 Table of Contents

🏁 Getting Started

Installing

npm i @nanomatic/object_filter

Using

Example code below:

import { getArray, getObject } from '@nanomatic/object_filter';

const salary = {
    Bill: 1350,
    Jackson: 1270,
    Jenny: 1100,
    Jhon: 1200,
    Joseph: 1500
};

const array = getArray(salary, /^J/);
const object = getObject(salary, /^B/);

const sum = array.reduce((sum: number, salary: number) => sum + salary, 0);

console.log(`Sum salary for all J's persons: 💲${sum}`);
console.log(`Jenny salary: 💲${object.Jeny || '?'}`);
console.log(`Bill salary: 💲${object.Bill || '?'}`);

⛏️ Built With

✍️ Authors

🎉 Acknowledgments

  • Special thanks for Sebastian for working together and giving ideas 😉

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i @nanomatic/object_filter

    Homepage

    nanomatic.pl

    Weekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.33 kB

    Total Files

    4

    Last publish

    Collaborators

    • nano_matic