This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* given a function, strips out its body code and optionally replaces | |
* template tags (variable names surrounded by double-underscores, | |
* e.g., __foo__) replacing them with values from a passed in object | |
*/ | |
__compile__ = function (fnc, obj) { | |
var body = fnc.toString().match(/^function\s*[0-9a-zA-Z_$]*\s*\([\w\s,\$_]*\)\s*\{(?:\s*\n?)?([\w\W\s]*)\n?\}$/m)[1] | |
if (obj === undefined) | |
return body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* every NodeObject's prototype is another NodeObject. The lowest level | |
* NodeObject's prototype is the NodeObject prototype. | |
* | |
* Each NodeObject has two default properties | |
* {NodeObject} parent : reference to the NodeObject that created this, also | |
* will be this NodeObject's prototype | |
* {NodeObjects[]} childNodes : every node created from this node using the | |
* create method will be added to this array | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toObject = (val) -> | |
if !val? | |
throw new TypeError() | |
return Object(val) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* creates an array-like list of items. each item can have multiple 'terms' | |
* associated with it, and you can filter the list of items down by accessing | |
* those terms as properties of the object. To get the results of the query | |
* just end with parens, like: | |
* | |
* myObj.foo.bar() = [all objects with foo and bar terms]; | |
* | |
* passing in values into the function call will add them as values with the | |
* current query as their terms. so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* catches any modifications to the given object (usually the global/window) | |
* object, and places them in a 'trap' object. Can prevent variable leak | |
* from missing var statements, as well as any modifications to the 'this' | |
* object inside of the function. | |
* @param {Object} t - trap object to use. Its necessary to pass in instead | |
* of returning because we still might want the return | |
* value of the function we're calling. | |
* @param {Function} f - function to call | |
* @param {Object} c - context to call function in. this is also the object |
NewerOlder