🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

purefuncs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

purefuncs

Extract pure functions from javascript code for unit testing

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 03 Mar 2016

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