1 |
|
2 |
|
3 |
|
4 |
|
5 | (function(define) { 'use strict';
|
6 | define(function() {
|
7 |
|
8 | return function liftAll(liftOne, combine, dst, src) {
|
9 | if(typeof combine === 'undefined') {
|
10 | combine = defaultCombine;
|
11 | }
|
12 |
|
13 | return Object.keys(src).reduce(function(dst, key) {
|
14 | var f = src[key];
|
15 | return typeof f === 'function' ? combine(dst, liftOne(f), key) : dst;
|
16 | }, typeof dst === 'undefined' ? defaultDst(src) : dst);
|
17 | };
|
18 |
|
19 | function defaultCombine(o, f, k) {
|
20 | o[k] = f;
|
21 | return o;
|
22 | }
|
23 |
|
24 | function defaultDst(src) {
|
25 | return typeof src === 'function' ? src.bind() : Object.create(src);
|
26 | }
|
27 | });
|
28 | }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));
|