Laminar
  • Laminar
  • Platform
    • Overview
    • Getting Started
    • Advanced
      • Configurations
      • HTTP Request Batching
      • Workflow Exit Points
      • Invoke Secondary Workflows
      • Managing Notifications
    • Best Practices
    • Keywords
      • lam.resolveThenExecute
      • lam.exit
      • lam.execute
      • lam.asyncExecute
      • lam.httpRequest
      • lam.httpRequests
  • Concepts
    • Workflows
      • Global Workflow Object
    • Flows
      • Flow Types
        • HTTP Request
        • Data Transformations
      • Flow Runs
      • Supported Languages
    • API Key
    • Configurations
    • API
      • Reference
        • Workspaces
          • Issues
          • Users
          • Invitations
            • Decline
            • Accept
            • Received
            • Created
          • Workflows
          • Flows
          • Auth credentials
          • Api keys
          • Api descriptions
        • Workflow
          • Execute
            • External
          • Flows
          • Executions
        • Users
        • Flows
          • Runs
          • Versions
          • Stats
          • Recent runs
          • Read
        • Configurations
          • Properties
          • Flow credentials
          • Workspace
        • Auth credentials
        • Api descriptions
        • Api keys
        • Transform
          • Test
        • Lami
          • Public
          • Direct
        • Auth
          • Signin
          • Register
          • Refresh
          • Me
          • Users
            • Password
    • Changelog
  • External Links
    • Book a Demo
    • Playground
    • Sign In
  • Specification
Powered by GitBook
On this page
  • Example: Format User Names
  • Example: Filter and Enrich Orders

Was this helpful?

  1. Concepts
  2. Flows
  3. Flow Types

Data Transformations

Learn about writing data transformations in Laminar Editor

Transformations allow you to modify data before or after making HTTP requests. They are written as JavaScript arrow functions and have access to specific libraries to help with data manipulation. The following imports are available:

* lodash as _
* date-fns: { format, parseISO }

Example: Format User Names

Let's start with a basic transformation that formats user names to uppercase:

// Transform user names to uppercase
(payload) => {
  const users = payload.step_2.response
  return users.map(user => ({
    ...user,
    name: user.name.toUpperCase()
  }));
}

Example: Filter and Enrich Orders

This example filters out canceled orders and adds formatted date strings:

// The `format` function is already available, no need to import
(payload) => {
  const orders = payload.input
  return orders
    .filter(order => order.status !== 'canceled')
    .map(order => ({
      ...order,
      formattedDate: format(new Date(order.createdAt), 'MMM dd, yyyy')
    }));
}
PreviousHTTP RequestNextFlow Runs

Last updated 1 month ago

Was this helpful?