MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / pickBy

Function pickBy

tests/test_code/js/moment/moment.js:3056–3071  ·  view source on GitHub ↗
(fn, moments)

Source from the content-addressed store, hash-verified

3054 // moments should either be an array of moment objects or an array, whose
3055 // first element is an array of moment objects.
3056 function pickBy(fn, moments) {
3057 var res, i;
3058 if (moments.length === 1 && isArray(moments[0])) {
3059 moments = moments[0];
3060 }
3061 if (!moments.length) {
3062 return createLocal();
3063 }
3064 res = moments[0];
3065 for (i = 1; i < moments.length; ++i) {
3066 if (!moments[i].isValid() || moments[i][fn](res)) {
3067 res = moments[i];
3068 }
3069 }
3070 return res;
3071 }
3072
3073 // TODO: Use [].sort instead?
3074 function min() {

Callers 2

minFunction · 0.85
maxFunction · 0.85

Calls 2

isArrayFunction · 0.85
createLocalFunction · 0.85

Tested by

no test coverage detected