Narwhals Prolong Mischief

    cjs-transform

    0.0.1 • Public • Published

    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

    Keywords

    none

    Install

    npm i cjs-transform

    DownloadsWeekly Downloads

    2

    Version

    0.0.1

    License

    BSD

    Last publish

    Collaborators

    • kimjoar