Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

dslify

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dslify

Rewrites a function in terms of a DSL

Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
10
Maintainers
1
Weekly downloads
 
Created
Source

dslify

Rewrites a JavaScript function, such that any global property access is transformed to call a member of a dsl argument. Use dslify to build small domain-specific languages and configuration utilities.

Install

npm install dslify

Example

var dslify = require('dslify');

var fn = function() { return shout(word); };
var shouter = dslify.transform(fn);

var dsl = {
    shout: function(something) {
        return something + "!!";
    },
    word: "unicorns"
};
shouter(dsl); // unicorns!!

How?

dslify parses functions using esprima, rewriting them as new functions using escodegen.

Is this wise?

Maybe, maybe not. You decide.

License

BSD

Keywords

dsl

FAQs

Package last updated on 29 Jun 2013

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