New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

filterer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filterer

Type-safe way to create filters array by assigning value to draft object

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Filterer

Type-safe way to create filters array by assigning value to draft object

Demo

interface Person {
  name: string;
  age: number;
  favourite: {
    food: Food[];
  };
  hasCar: boolean;
}

type Food = 'pizza' | 'hamburger';

const filters = createFilters<Person>((person) => {
  person.name = 'Bob';
  person.age = ['>', 20];
  person.favourite.food = ['includes', 'pizza'];
  person.hasCar = true;
});

console.log(filters);
// [
//   {
//     path: ['name'],
//     value: 'Bob'
//   },
//   {
//     path: ['age'],
//     value: ['>', 20]
//   },
//   {
//     path: ['favourite', 'food'],
//     value: ['includes', 'pizza']
//   },
//   {
//     path: ['hasCar'],
//     value: true
//   }
// ]

yarn add filterer

Licence

MIT

Keywords

filters

FAQs

Package last updated on 22 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts