0.1.2 • Published 10 years ago

acclimate-variables v0.1.2

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

acclimate-variables

rename all invalid identifiers in an AST

Motivation

When compiling to JS its a pain to worry if the identifiers you generate are safe to use in JS code. And if not what is. With this module you just don't worry it at all then, just before you generate your JS, run your AST through the acclimate function.

Installation

With your favorite package manager:

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

then in your app:

var acclimate = require('acclimate-variables')

API

acclimate(node)

translate all identifiers in node to ones safe to use in JS code.

acclimate({type:'Identifier', name: 'number->string'}) // => {type:'Identifier', name: 'numberToString'}
acclimate({type:'Identifier', name: 'string?'}) // => {type:'Identifier', name: 'isString'}
0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago