github markup
This commit is contained in:
@ -2,21 +2,22 @@
|
|||||||
|
|
||||||
Filter an array of objects based on condition and return array with reduced objects.
|
Filter an array of objects based on condition and return array with reduced objects.
|
||||||
|
|
||||||
// ----------------------------------- Input -----------------------------------//
|
#### Input
|
||||||
// 1. Data: the data to be filtered (array of objects) -------------------------//
|
|
||||||
// 2. Condition: will be used for filtering (string) ---------------------------//
|
|
||||||
// 3. outputProps: an array of properties that will be used to contruct --------//
|
|
||||||
// new array of objects --------------------------------------------------------//
|
|
||||||
|
|
||||||
// ----------------------------------- Output ----------------------------------//
|
i. Data: the data to be filtered (array of objects)
|
||||||
// Filtered array with new objects. Properties of new objects are a subset of --//
|
ii. Condition: will be used for filtering (string)
|
||||||
// properties of original objects ----------------------------------------------//
|
iii. outputProps: an array of properties that will be used to contruct new array of objects
|
||||||
|
|
||||||
// ----------------------------------- Info ------------------------------------//
|
#### Output
|
||||||
// Used ES6 reduce -------------------------------------------------------------//
|
|
||||||
// Dummy data for testing ------------------------------------------------------//
|
|
||||||
// Generated with http://www.mockaroo.com/ -------------------------------------//
|
|
||||||
|
|
||||||
|
Filtered array with new objects. Properties of new objects are a subset of
|
||||||
|
properties of original objects
|
||||||
|
|
||||||
|
#### Info
|
||||||
|
|
||||||
|
Used ES6 reduce
|
||||||
|
Dummy data for testing
|
||||||
|
Generated with http://www.mockaroo.com/
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const reducedFilter = (data, condition, outputProps) =>
|
const reducedFilter = (data, condition, outputProps) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user