(id, dependencies, definition)
| 53 | } |
| 54 | |
| 55 | function define(id, dependencies, definition) { |
| 56 | if (typeof id !== 'string') { |
| 57 | throw 'invalid module definition, module id must be defined and be a string'; |
| 58 | } |
| 59 | |
| 60 | if (dependencies === undefined) { |
| 61 | throw 'invalid module definition, dependencies must be specified'; |
| 62 | } |
| 63 | |
| 64 | if (definition === undefined) { |
| 65 | throw 'invalid module definition, definition function must be specified'; |
| 66 | } |
| 67 | |
| 68 | require(dependencies, function() { |
| 69 | modules[id] = definition.apply(null, arguments); |
| 70 | }); |
| 71 | } |
| 72 | |
| 73 | function defined(id) { |
| 74 | return !!modules[id]; |
no test coverage detected