MCPcopy Create free account
hub / github.com/breck7/scroll / _selector_run

Function _selector_run

external/.datatables.js:7016–7059  ·  view source on GitHub ↗
(type, selector, selectFn, settings, opts)

Source from the content-addressed store, hash-verified

7014 })
7015
7016 var _selector_run = function (type, selector, selectFn, settings, opts) {
7017 var out = [],
7018 res,
7019 a,
7020 i,
7021 ien,
7022 j,
7023 jen,
7024 selectorType = typeof selector
7025
7026 // Can't just check for isArray here, as an API or jQuery instance might be
7027 // given with their array like look
7028 if (!selector || selectorType === "string" || selectorType === "function" || selector.length === undefined) {
7029 selector = [selector]
7030 }
7031
7032 for (i = 0, ien = selector.length; i < ien; i++) {
7033 // Only split on simple strings - complex expressions will be jQuery selectors
7034 a = selector[i] && selector[i].split && !selector[i].match(/[[(:]/) ? selector[i].split(",") : [selector[i]]
7035
7036 for (j = 0, jen = a.length; j < jen; j++) {
7037 res = selectFn(typeof a[j] === "string" ? a[j].trim() : a[j])
7038
7039 // Remove empty items
7040 res = res.filter(function (item) {
7041 return item !== null && item !== undefined
7042 })
7043
7044 if (res && res.length) {
7045 out = out.concat(res)
7046 }
7047 }
7048 }
7049
7050 // selector extensions
7051 var ext = _ext.selector[type]
7052 if (ext.length) {
7053 for (i = 0, ien = ext.length; i < ien; i++) {
7054 out = ext[i](settings, opts, out)
7055 }
7056 }
7057
7058 return _unique(out)
7059 }
7060
7061 var _selector_opts = function (opts) {
7062 if (!opts) {

Callers 3

__row_selectorFunction · 0.85
__column_selectorFunction · 0.85
__cell_selectorFunction · 0.85

Calls 5

_uniqueFunction · 0.85
splitMethod · 0.80
trimMethod · 0.80
concatMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected