Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure the documentation is clearer with use of dependency options
- Loading branch information
Simon Harte
committed
Oct 5, 2015
1 parent
3b13160
commit 15ff2f3
Showing
2 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
'use strict'; | ||
var umdify = require('./'); | ||
|
||
|
||
main(); | ||
|
||
function main() { | ||
var result = umdify('demo();', { | ||
deps: { | ||
'default': ['foobar'], | ||
'amd': ['foo', 'bar'], | ||
// use default only if the module name and the variable the module will be injected with is the same | ||
'default': ['Foo'], | ||
// additionally define these if the module name differs from the variable with which it will be used | ||
'amd': ['foo'], | ||
'cjs': ['foo'] | ||
} | ||
}); | ||
|
||
console.log(result); | ||
/** | ||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module unless amdModuleId is set | ||
define(["foo"], function (a0) { | ||
return (factory(a0)); | ||
}); | ||
} else if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(require("foo")); | ||
} else { | ||
factory(Foo); | ||
} | ||
}(this, function (Foo) { | ||
demo(); | ||
})); | ||
*/ | ||
} |