Skip to content

Conversation

@vlaurin
Copy link
Contributor

@vlaurin vlaurin commented Jun 21, 2021

Resolves #130

Example:

import {fieldExtractor} from '@quickcase/node-toolkit';

const aCase = {
  id: '1234123412341234',
  state: 'Open',
  data: {
    collection3: [
      {id: '123', value: {field2: 'value3'}},
      {id: '456', value: {field2: 'value4'}},
    ]
  }
};

// Prepare fields for extraction
const fields = fieldExtractor(aCase);

// Extract from collections
const value3 = fields('collection3[0].field2'); // By index
const value4 = fields('collection3[id:456].field2'); // By id

@vlaurin vlaurin requested a review from gbenadikar June 21, 2021 10:41
vlaurin added 2 commits June 21, 2021 13:04
Part of #130
Ability to extract items from collection based on their index position
Resolves #130
Ability to extract items from collection based on their unique identifier
@vlaurin vlaurin force-pushed the 130-fieldextractor-collection branch from a05bf5f to 35e2bf4 Compare June 21, 2021 12:15
@vlaurin vlaurin merged commit b70025e into main Jun 22, 2021
@vlaurin vlaurin deleted the 130-fieldextractor-collection branch June 22, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Case: fieldExtractor: Add support for extraction of collection items

3 participants