unless-macro
v1.1.0
Published
Proper usage of Ruby's unless in JavaScript
Downloads
5
Readme
unless
Examples
unless (foo) {
bar()
baz()
}
expands to
if (!foo) {
function () {
bar()
baz()
}()
}
return foo unless (bar)
expands to
if (!bar) {
return foo
}
foo unless (bar)
expands to
if (!bar) {
function () {
foo
}()
}
Installation
$ npm install --save unless-macro
.Load using sweetjs-loader like,
// webpack.config.js
module.exports = {
cache: true,
entry: 'app.js',
output: {
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.js$/, loader: 'sweetjs?modules[]=unless-macro/unless.sjs'
}]
}
};
to expand the macro at build time.