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]);