Skip to content

Conversation

saar
Copy link

@saar saar commented May 30, 2019

If the array includes a callback function as 3rd element, all the results pass through that transformer. Returned values are the result of selector.
For example:

date_published: {
    selectors: [[
        'meta[name="article:published_time"]',
         'value',
          (item) => moment.from(convertNumbersToEnglish(item), 'fa',
            'YYYY/MM/DD - HH:mm').toISOString();
    ]]
}
extend: {
  tags: {
    selectors: [[
        'meta[name=\'article:tag\']', 'value', (item) => {
        return item.split(/\s*,\s*/);
      }]],
    allowMultiple: true
  }
}

If 3rd element of the selector's array is a function, all result forward to it as first parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants