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

apply-transform

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apply-transform

Applies a transform to an input string and calls back with result, mostly useful for testing transforms

latest
Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
12
9.09%
Maintainers
1
Weekly downloads
 
Created
Source

apply-transform build status

testling badge

Applies a transform to an input string and calls back with result, mostly useful for testing transforms

var applyTransform = require('apply-transform')
  , assert = require('assert')
  , through = require('through2');

function toUpper() {
  return through(
    function (chunk, enc, cb) {
      this.push(chunk.toUpperCase());
      cb();
    }
  )
}

var tx = toUpper();
tx._writableState.decodeStrings = false;

applyTransform(tx, 'hello world', function (err, res) {
  if (err) return assert.fail(err); 
  assert.equal(res, 'HELLO WORLD', 'calls back with transformed result')
})  

Installation

npm install apply-transform

API

/**
 * Applies the given transform to the input and calls back with result.
 * 
 * @name 
 * @function
 * @param {TransformStream} transform to apply to the @see input
 * @param {String} input to transform
 * @param {Function} cb function(err, output) { }
 *  - {Error} err: is set if an error occurred
 *  - {String} output: the result of applying the @see transform to the @see input
 * @return {ReadableStream} that streams the input string char by char, useful for debugging failing transforms
 */

License

MIT

Keywords

transform

FAQs

Package last updated on 28 Jan 2014

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