The collection.extract( ) method creates and returns a new collection containing propertyPath values extracted from the original collection of objects.
Note: This method does not modify the original collection.
The contents of the returned collection depends on the targetPath parameter:
- If the targetPath parameter is omitted, collection.extract( ) populates the new collection with the propertyPath values of the original collection.
By default, elements for which propertyPath is null or undefined are ignored in the resulting collection. You can pass the ck keep null constant in the option parameter to include these values as null elements in the returned collection.
- If one or more targetPath parameter(s) are passed, collection.extract( ) populates the new collection with the propertyPath properties and each element of the new collection is an object with targetPath properties filled with the corresponding propertyPath properties. Null values are kept (option parameter is ignored with this syntax).