6.0.0 • Published 2 months ago

filter-obj v6.0.0

Weekly downloads
1,828,015
License
MIT
Repository
github
Last release
2 months 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>

An array 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@314oner_npm/universal-components-libraryzona-x@garyos/bash-parserzubtesttodaywinx-form-winxtypegeeseuimounix-permissionsvk-api-calls@grund/toolsfluid-tailwindvision-camera-plugin-scan-facesuvccwowsearchfeedback-webexpo-renavigate@louissoftware/query-string@ginjou/vuefullnameftl-netlify-build@modern-js/libuild-plugin-node-polyfillgassefalsgassefals-2gaurav-react-native-loop@navabi/react-native-ssl-pinning@modern-js/plugin-module-node-polyfill@netlify/zip-it-and-ship-it@netlify/framework-info@netlify/build@netlify/configget-node-cli@jfilipe-sparta/react-native-module_2@safely-project/safely-ts@parallelnft/web3modal@react-18-pdf/root@rocket.chat/api-client@rspack/plugin-node-polyfill@saad27/react-native-bottom-tab-tour@positionex/position-sdkdynamics-contracts-xenefti-galeri@ifanshx/cycgodsenvyhandle-cli-error@originjs/openharmony-webpack-plugingulp-execa@purnasatria/directus-extension-document-interface@pwa/manifest-cli@silver0542/directus-extension-cma-components-editor@ericcornelissen/bash-parser@enkeledi/react-native-week-month-date-picker@sitecore-search/common@sitecore-discover/commonjolt-framework@speedy-js/speedy-plugin-node-polyfilljson-search.repojulienp-netlify@taingo97/react-native-expo-key-rsa-kt@taingo97/react-native-expo-rsa@taingo97/react-native-rsa@taingo97/react-native-telpo-printerbash-parsernetlify-redirect-parsernetlify-cli-fork@buganto/clientboolean-filter-objmodern-errorsaws-testing-librarylambda-voielob-check-cliluojia-cli-devcandlelabssdk@cyber-tools/spa-build-tools@cyber-tools/spa-clinpm_qwerty@con-test/react-native-concent-commonnode-version-aliasnpm-scout@danizean/cyberzonenpm_one_1_2_3npm_one_2_2npm_one_12_34_1_@authnomicon/federatedastra-ufo-sdk@wecraftapps/react-native-use-keyboardmavectra@adobe/httptransfernode-polyfill-webpack-plugin-myh
6.0.0

2 months ago

5.1.0

2 years ago

4.0.0

2 years ago

5.0.0

2 years ago

3.0.0

3 years ago

2.0.2

3 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

9 years ago

1.0.0

9 years ago