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