Skip to content

Instantly share code, notes, and snippets.

@avisser
Created April 20, 2018 16:22
Show Gist options
  • Save avisser/d5577692b7511dad24599ac9395dd249 to your computer and use it in GitHub Desktop.
Save avisser/d5577692b7511dad24599ac9395dd249 to your computer and use it in GitHub Desktop.
js.resource
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.ActionUtils = factory();
}
}(this, function() {
'use strict';
return {
generateId : function (len) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for( var i=0; i < len; i++ ) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment