This file contains 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
var Hmm = (function() | |
{ //A snippet/library to find records in table-like JS arrays | |
function getNamedValue( o , name ) | |
{ //Name can have dots, 'car.tire.brand.name' should get the expected | |
var parts = name.split("."); | |
while( parts.length && o ){ | |
o = o[parts.shift()]; | |
} | |
return o; |
This file contains 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
//Good | |
function lambdafy( f ) | |
{ | |
return function lambdafier() { | |
var args = Array.prototype.slice.call(arguments); | |
return function lambda(){ | |
f.apply( this , args ); | |
} | |
} | |
} |
This file contains 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
function fillTemplate( s ) | |
{ //Replace ~ with further provided arguments | |
for( var i = 1, a = s.split('~'), s = '' ; i < arguments.length ; i++ ) | |
s = s + a.shift() + arguments[i]; | |
return s + a.join(""); | |
} |
NewerOlder