MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / select

Function select

code/styling/public/app.js:22972–22999  ·  view source on GitHub ↗

* Select * * @param {Array } parent * @param {string} current * @param {number} invert * @return {Array }

(parent, current, invert)

Source from the content-addressed store, hash-verified

22970 * @return {Array<string>}
22971 */
22972 function select (parent, current, invert) {
22973 var selectors = current.trim().split(selectorptn)
22974 var out = selectors
22975
22976 var length = selectors.length
22977 var l = parent.length
22978
22979 switch (l) {
22980 // 0-1 parent selectors
22981 case 0:
22982 case 1: {
22983 for (var i = 0, selector = l === 0 ? '' : parent[0] + ' '; i < length; ++i) {
22984 out[i] = scope(selector, out[i], invert, l).trim()
22985 }
22986 break
22987 }
22988 // >2 parent selectors, nested
22989 default: {
22990 for (var i = 0, j = 0, out = []; i < length; ++i) {
22991 for (var k = 0; k < l; ++k) {
22992 out[j++] = scope(parent[k] + ' ', selectors[i], invert, l).trim()
22993 }
22994 }
22995 }
22996 }
22997
22998 return out
22999 }
23000
23001 /**
23002 * Scope

Callers 1

compileFunction · 0.85

Calls 1

scopeFunction · 0.85

Tested by

no test coverage detected