6.1.0 • Published 1 year ago

filter-obj v6.1.0

Weekly downloads
1,828,015
License
MIT
Repository
github
Last release
1 year ago

filter-obj

Filter object keys and values into a new object

Install

npm install filter-obj

Usage

import {includeKeys, excludeKeys} from 'filter-obj';

const object = {
	foo: true,
	bar: false
};

const newObject = includeKeys(object, (key, value) => value === true);
//=> {foo: true}

const newObject2 = includeKeys(object, ['bar']);
//=> {bar: false}

const newObject = excludeKeys(object, (key, value) => value === true);
//=> {bar: false}

const newObject3 = excludeKeys(object, ['bar']);
//=> {foo: true}

API

includeKeys(source, filter)

includeKeys(source, keys)

excludeKeys(source, filter)

excludeKeys(source, keys)

source

Type: object

The source object to filter properties from.

filter

Type: (sourceKey: string | symbol, sourceValue: unknown, source: object) => boolean

A predicate function that determines whether a property should be filtered.

keys

Type: Array<string | symbol> | Set<string | symbol>

An array or Set of property keys to be filtered.

Related

  • map-obj - Map object keys and values into a new object
query-stringcreate-obj@frxf/frxfdeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdkreact-native-printer-brothersreact-native-shekhar-bridge-testcogoportutilswilscanner@infinitebrahmanuniverse/nolb-filt@everything-registry/sub-chunk-1667@yabe-siul/fluid-tailwindwinx-form-winxwowsearchvk-api-callsvision-camera-plugin-scan-faces@con-test/react-native-concent-common@cyber-tools/spa-build-tools@cyber-tools/spa-cli@rspack/plugin-node-polyfill@positionex/position-sdkjolt-frameworkjulienp-netlifyjson-categorizejson-search.repojnf-accesscontrol-rnttl@purnasatria/directus-extension-document-interfacestyled-map-packagespydtypegeeseuimoterminal-themeunix-permissions@authnomicon/federated@adobe/httptransfer@ajaykewat/myboilerplate@buganto/client128981semzub@defin/get-node@danizean/cyberzonezona-xzubtesttodayuvcc@parallelnft/web3modal@grund/tools@hoang_ng/directus-extension-dependent-fields@ifanshx/cycgods@garyos/bash-parser@louissoftware/query-string@netlify/zip-it-and-ship-it@netlify/build@netlify/config@netlify/framework-info@navabi/react-native-ssl-pinning@enkeledi/react-native-week-month-date-picker@ericcornelissen/bash-parser@modern-js/libuild-plugin-node-polyfill@modern-js/plugin-module-node-polyfill@monkeyplus/esm-netlify-config@jfilipe-sparta/react-native-module_2@react-18-pdf/root@pwa/manifest-cli@safely-project/safely-ts@saad27/react-native-bottom-tab-tour@scayle/admin-api@reagentai/react@reagentai/reagent@originjs/openharmony-webpack-plugin@speedy-js/speedy-plugin-node-polyfill@rocket.chat/api-clientmodern-errorsmonaco-pythonnative-date-picker-modulepackage-json-clinpm_qwertynpm_one_12_34_1_npm_one_1_2_3npm_one_2_2obj-explorerobj-search.reponvepayutestingreact-native-dsphoto-modulereact-native-custom-poccomponentreact-native-create-video-thumbnailreact-native-cplusreact-native-modal-progress-barreac-native-arun-ramya-testrn-circular-chartrn-adyen-dropinrspack-plugin-node-polyfillrum-nodern-tm-notifyrn-session-multiplier-demoreact-native-arun-ramya-testreact-native-arunjeyam1987react-native-arunmeena1987react-native-arunramya151react-native-bubble-chart
6.1.0

1 year ago

6.0.0

1 year ago

5.1.0

3 years ago

4.0.0

3 years ago

5.0.0

3 years ago

3.0.0

4 years ago

2.0.2

4 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.0

10 years ago

1.0.0

10 years ago