New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

object-transform-stack

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-transform-stack

Simple module to map one object to another using a stack of declarative pointers and transforms

latest
Source
npmnpm
Version
3.3.0
Version published
Weekly downloads
18
-59.09%
Maintainers
1
Weekly downloads
 
Created
Source

object-transform-stack NPM version Downloads Build Status

Install

npm install object-transform-stack --save

Usage

import { transform } from 'object-transform-stack'

const transforms = {
  trim: {
    name: 'Trim',
    signature: [
      {
        name: 'Text',
        types: [ 'string' ],
        required: true
      }
    ],
    returns: 'string',
    execute: (v) => v.trim()
  }
}

const stack = {
  bday: { field: 'birth' },
  name: {
    transform: 'trim',
    arguments: [ { field: 'name.legal' } ]
  }
}

const input = {
  name: {
    legal: 'Don Adams',
    preferred: 'Donny'
  },
  birth: '11/12/27'
}

console.log(await transform(stack, input, { transforms }))
/*
Prints:

{
  "bday": "2027-11-12T05:00:00.000Z",
  "name": "Don Adams"
}
*/

Keywords

transform

FAQs

Package last updated on 25 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts