Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Created March 6, 2010 04:49
Show Gist options
  • Select an option

  • Save tim-smart/323500 to your computer and use it in GitHub Desktop.

Select an option

Save tim-smart/323500 to your computer and use it in GitHub Desktop.
var Test = function Test() {};
var temp = function Test() {};
temp.prototype = Array.prototype;
Test.prototype = new temp();
Test.prototype.constructor = Test;
// Prints "Test"
new Test().constructor.name;
// We can then process the name to generate our url names
// "Test" would be "test", "TestModel" would be "test_model", "Test_Model" would also be "test_model"
// Over-riden by __name property or something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment