free-variables
get a list of variables used in a JS program
Last updated 11 years ago by jkroso .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install free-variables 
SYNC missed versions from official npm registry.

free-variables

Get a list of free variables used in a JS program. A free variable is one which is used but not declared.

Installation

With your favorite package manager:

  • packin: packin add free-variables
  • component: component install jkroso/free-variables
  • npm: npm install free-variables

then in your app:

var free = require('free-variables')

API

free(ast)

Takes any standard JS AST and returns and Array of String's

var parse = require('esprima').parse
free(parse('console.log')) // => ['console']
free(parse('console[log]')) // => ['console', 'log']
free(parse('function b(){a}')) // => ['a']
free(parse('var a = 1; a + b')) // => ['b']
free(parse('a; var a')) // => []

Current Tags

  • 0.1.1                                ...           latest (11 years ago)

2 Versions

  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (9)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |