MCPcopy Create free account
hub / github.com/cuth/postcss-pxtorem / createPropListMatcher

Function createPropListMatcher

index.js:76–117  ·  view source on GitHub ↗
(propList)

Source from the content-addressed store, hash-verified

74}
75
76function createPropListMatcher(propList) {
77 const hasWild = propList.indexOf("*") > -1;
78 const matchAll = hasWild && propList.length === 1;
79 const lists = {
80 exact: filterPropList.exact(propList),
81 contain: filterPropList.contain(propList),
82 startWith: filterPropList.startWith(propList),
83 endWith: filterPropList.endWith(propList),
84 notExact: filterPropList.notExact(propList),
85 notContain: filterPropList.notContain(propList),
86 notStartWith: filterPropList.notStartWith(propList),
87 notEndWith: filterPropList.notEndWith(propList)
88 };
89 return prop => {
90 if (matchAll) return true;
91 return (
92 (hasWild ||
93 lists.exact.indexOf(prop) > -1 ||
94 lists.contain.some(function(m) {
95 return prop.indexOf(m) > -1;
96 }) ||
97 lists.startWith.some(function(m) {
98 return prop.indexOf(m) === 0;
99 }) ||
100 lists.endWith.some(function(m) {
101 return prop.indexOf(m) === prop.length - m.length;
102 })) &&
103 !(
104 lists.notExact.indexOf(prop) > -1 ||
105 lists.notContain.some(function(m) {
106 return prop.indexOf(m) > -1;
107 }) ||
108 lists.notStartWith.some(function(m) {
109 return prop.indexOf(m) === 0;
110 }) ||
111 lists.notEndWith.some(function(m) {
112 return prop.indexOf(m) === prop.length - m.length;
113 })
114 )
115 );
116 };
117}
118
119module.exports = (options = {}) => {
120 convertLegacyOptions(options);

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…