jrburke/almond — Issue #9: Cannot read property 'splice' of undefined when using store.js
Author: jbasdf
Created: 2012-01-11 18:52:31+00:00
State: open

Store.js defines itself by passing the store object:

if (typeof module != 'undefined') { module.exports = store }
else if (typeof define === 'function' && define.amd) { define(store) }
else { this.store = store }

This means that in the almond.js code the store object is passed for 'name' and deps and callback are undefined:

define = function (name, deps, callback) {

//This module may not have dependencies
if (!deps.splice) {
//deps is not an array, so probably means
//an object literal or factory function for
//the value. Adjust args.
callback = deps;
deps = [];
}

if (define.unordered) {
waiting[name] = [name, deps, callback];
} else {
main(name, deps, callback);
}
};

This results in the error:
Cannot read property 'splice' of undefined

Let me know if you need the full javascript file and I can email it.