cjs-transform
v0.0.1
Published
Transform Require.js module to use simplified CommonJS wrapper
Downloads
3
Readme
Transform Require.js modules to use simplified CommonJS wrapper
I prefer to use the simplified CommonJS wrapper when using Require.js.
This module transforms the following:
define([
'test',
'./relative/folder/test',
'module/here', 'on/same/line',
'noVar'
], function(test, relativeFolder, someModule, sameLine) {
test.doSomething();
relativeFolder();
});
into:
define(function(require) {
var test = require('test');
var relativeFolder = require('./relative/folder/test');
var someModule = require('module/here');
var sameLine = require('on/same/line');
require('noVar');
test.doSomething();
relativeFolder();
});
API
var cjsTransform = require('cjs-transform');
var isTransformed = cjsTransform(from[, to]);
// if `to` is not specified, it changes `from`
// there is no async version