Skip to content

Instantly share code, notes, and snippets.

@cammerman
Created June 6, 2013 05:13
Show Gist options
  • Save cammerman/5719456 to your computer and use it in GitHub Desktop.
Save cammerman/5719456 to your computer and use it in GitHub Desktop.
define(
['underscore'],
function (_) {
// Outputs "true"
console.log(_.deepClone !== undefined);
}
);
require.config({
map: {
'*': {
'underscore': 'underscore-extensions'
},
'underscore-extensions': {
'underscore': 'underscore'
}
}
});
// This is a shim module that adds functionality to Underscore.js that we want to be availabla
// everywhere within our project.
define(
['underscore'],
function (_) {
// define extra helpers attached to _
_.deepClone = function () {
/* ... */
}
return _;
}
);
// This is just the real underscore file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment