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-facesjolt-frameworkjulienp-netlifyjson-categorizejson-search.repojnf-accesscontrol-rnttlhttp-query-stringgulp-execahandle-cli-errorluojia-cli-devloading-animatedlob-check-clilambda-voiemavectra@wecraftapps/react-native-use-keyboardalisselisss-lab3all-node-versionsastra-ufo-sdk@grund/tools@happy-gastro/react-native-printer-module@purnasatria/directus-extension-document-interfacestyled-map-packagespydtypegeeseuimoterminal-themeunix-permissionszona-xzubtesttodayuvcc@louissoftware/query-stringmodern-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-chartreact-native-badge-controlreact-native-biometric-authenticatepwa-manifest-clireact-native-my-first-try-arun-ramyareact-native-payu-payment-testingreact-native-meon-edocreact-native-jsi-device-infosaasify-faas-proxyreact-native-teads-sdk-modulereact-native-syan-photo-pickerreact-native-sunmi-printer-hkreact-native-video-typoreact-native-transtracker-libraryreact-native-sayhello-modulereact-native-pool-corereact-native-ytximkitnode-builtin-polyfill-webpack-pluginnode-polyfill-webpack-plugin-myhnetlify-redirect-parsernetlify-cli-forknormalize-node-versionnode-stackifynode-version-aliasnpm-custom-lib-resue
6.1.0

1 year ago

6.0.0

2 years 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

5 years ago

2.0.1

6 years ago

2.0.0

7 years ago

1.1.0

10 years ago

1.0.0

10 years ago