purefuncs
Extract pure functions from javascript code for unit testing
Last updated 4 years ago by enkilabs .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install purefuncs 
SYNC missed versions from official npm registry.

WORK IN PROGRESS - DO NOT USE YET

Purefuncs

build dependencies devDependencies

license npm version npm downloads

Automatically extract pure functions from your javascript code for unit testing.

Installation

  npm install --save purefuncs

cli usage

Given:

// file: src/example.js
import {asd, boo} from 'asd'
import math from 'somewhere'
const z = 2;
function foo() {
  const x = 3 + z;
  function bla() {
    const f = 5 + asd;
    return x + 1;
  }
  function tada() {
    return x + math.sin(x);
  }
}

Run :

$ purefuncs src/example.js -o test/purefuncs/example.js

Output:

// file: test/purefuncs/example.js
export const foo = ({asd, math, z}) => () => {
  const x = 3 + z;
  function bla() {
    const f = 5 + asd;
    return x + 1;
  }
  function tada() {
    return x + math.sin(x);
  }
}

export const foo$bla = ({asd, x}) => () => {
  const f = 5 + asd;
  return x + 1;
}

export const foo$tada = ({math, x}) => () => {
  return x + math.sin(x);
}

License

MIT

Current Tags

  • 1.0.3                                ...           latest (4 years ago)

4 Versions

  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (15)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |