MCPcopy Create free account
hub / github.com/csev/py4e / pickBy

Function pickBy

code/gmane/Chart.bundle.js:3009–3024  ·  view source on GitHub ↗
(fn, moments)

Source from the content-addressed store, hash-verified

3007 // moments should either be an array of moment objects or an array, whose
3008 // first element is an array of moment objects.
3009 function pickBy(fn, moments) {
3010 var res, i;
3011 if (moments.length === 1 && isArray(moments[0])) {
3012 moments = moments[0];
3013 }
3014 if (!moments.length) {
3015 return local__createLocal();
3016 }
3017 res = moments[0];
3018 for (i = 1; i < moments.length; ++i) {
3019 if (!moments[i].isValid() || moments[i][fn](res)) {
3020 res = moments[i];
3021 }
3022 }
3023 return res;
3024 }
3025
3026 // TODO: Use [].sort instead?
3027 function min () {

Callers 2

minFunction · 0.85
maxFunction · 0.85

Calls 2

local__createLocalFunction · 0.85
isArrayFunction · 0.70

Tested by

no test coverage detected