-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathspike.js
More file actions
42 lines (36 loc) · 970 Bytes
/
spike.js
File metadata and controls
42 lines (36 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var webels = (function() {
"use strict";
var namespace = {};
namespace.prop = function(name) {
return function(obj) {
return obj[name];
};
};
namespace.func = function(name) {
return function(obj) {
if (typeof obj[name] === "function") {
return obj[name].apply(obj);
}
};
};
namespace.compose = function(chain) {
return function(arg) {
return chain.reduce(function(value, cb) {
return cb.call(null, value);
}, arg);
};
};
namespace.partial = function() {
var args = Array.prototype.slice.call(arguments, 0);
var cb = args.shift();
return function() {
return cb.apply(this,
args.concat( Array.prototype.slice.call(arguments, 0) )
);
};
};
return namespace;
}());
if (module) {
module.exports = webels;
}