Socket
Book a DemoInstallSign in
Socket

turn

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turn

minimal modules for a hypothetical es6 with lua's return

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

turn

minimal modules for a hypothetical es6 with lua's return, inspired by substack/mmmify and motivated by @shtylman.

build status

syntax

Use import PATH to load a module from the string PATH. import is a keyword like typeof that just returns an ordinary value.

Use return VALUE in the top level scope to export functionality and jump out of the current context.

example

// main.js

var foo = import './foo.js'
console.log(foo(5));
// foo.js

var bar = import './bar.js'
return function (n) { return bar(n) * 10 };
// bar.js

return function (n) { return n + 3 };

build it with browserify:

$ browserify -t turn main.js > bundle.js

then run it with node (or a browser):

$ node bundle.js
80

POW.

methods

var turn = require('turn')

This module is a browserify transform but you don't need to use browserify necessarily to use it.

turn()

Return a through-stream desugaring the import keyword and top level return into require() and module.exports=... that can be parsed by node and browserify.

install

With npm do:

npm install turn

license

MIT

FAQs

Package last updated on 09 Mar 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