Skip to content

Case: fieldExtractor: Add support for extraction of collection items #130

@vlaurin

Description

@vlaurin

Example

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

const aCase = {
  id: '1234123412341234',
  state: 'Open',
  data: {
    collectionText1: [
      {id: '123', value: 'text1'},
      {id: '456', value: 'text2'},
    ],
    collectionComplex1: [
      {id: 'abc', value: {nestedField: 'value1'}},
      {id: 'efg', value: {nestedField: 'value2'}},
    ],
  }
};

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

fields('collectionText1[0]'); // index-based
// 'text1'

fields('collectionText1[id:456]'); // ID-based
// 'text2'

fields('collectionComplex1[0].nestedField'); // index-based
// 'value1'

fields('collectionComplex1[id:efg].nestedField'); // ID-based
// 'value2'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions