JavaScript

Create a custom parser using JavaScript.

Example

engine: javascript
script: |
  // This script creates a slug from a title.

  // Import a library from NPM.
  import slugify from 'slugify@^1';

  // The `data` variable contains the data from the previous task.
  const slug = slugify(data.title);

  // The `callback` function sends data to the next task.
  callback({ title: data.title, slug: slug });
schema:
  type: object
  properties:
    title:
      type: string
    slug:
      type: string

Properties

NameType
engineString=javascript
scriptString
schemaObject

engine

Must be javascript.

Required
Yes

script

An ES2015 script to process incoming data.

Required
Yes

schema

Define a schema for the data that is returned by your script.

Required
Yes