diff options
Diffstat (limited to 'src/utility.js')
-rw-r--r-- | src/utility.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utility.js b/src/utility.js index 0a5a22fb..28d3fa93 100644 --- a/src/utility.js +++ b/src/utility.js @@ -53,6 +53,7 @@ function assertEq(a, b) { function assertTrue(a) { assertEq(!!a, true); } +assert = assertTrue; function dedup(items, ident) { var seen = {}; @@ -106,6 +107,12 @@ function values(x) { return ret; } +function bind(self, func) { + return function() { + func.apply(self, arguments); + } +} + function sum(x) { return x.reduce(function(a,b) { return a+b }, 0); } @@ -157,3 +164,10 @@ function concatenator(x, y) { return x.concat(y); } +function mergeInto(obj, other) { + for (i in other) { + obj[i] = other[i]; + } + return obj; +} + |