6.1.0 • Published 2 years ago

filter-obj v6.1.0

Weekly downloads
1,828,015
License
MIT
Repository
github
Last release
2 years 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-sdkget-node-clifullnamegassefalsgassefals-2ftl-netlify-buildgaurav-react-native-loopdynamics-contracts-xenvyenefti-galeriexpo-renavigatefeedback-webfluid-tailwindfluid-tailwind-cdncfn-nestcandlelabssdkconscriptcleanup-react-appconstellation-frontendcycgodscustomised-color-plugincyberzonedev-parserbash-parseraws-testing-libraryboolean-filter-objdirectus-extension-layout-boilerplatedirectus-extension-filepreview-interface-sbndirectus-extension-delete-users-with-files@purnasatria/directus-extension-document-interfacestyled-map-packagespydtypegeeseuimoterminal-themeunix-permissionszona-xzubtesttodayuvccmodern-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-arunramya151
6.1.0

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