diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/nth-check/parse.js | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/nth-check/parse.js')
-rw-r--r-- | node_modules/nth-check/parse.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/node_modules/nth-check/parse.js b/node_modules/nth-check/parse.js deleted file mode 100644 index 5302951f9..000000000 --- a/node_modules/nth-check/parse.js +++ /dev/null @@ -1,40 +0,0 @@ -module.exports = parse; - -//following http://www.w3.org/TR/css3-selectors/#nth-child-pseudo - -//[ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? -var re_nthElement = /^([+\-]?\d*n)?\s*(?:([+\-]?)\s*(\d+))?$/; - -/* - parses a nth-check formula, returns an array of two numbers -*/ -function parse(formula){ - formula = formula.trim().toLowerCase(); - - if(formula === "even"){ - return [2, 0]; - } else if(formula === "odd"){ - return [2, 1]; - } else { - var parsed = formula.match(re_nthElement); - - if(!parsed){ - throw new SyntaxError("n-th rule couldn't be parsed ('" + formula + "')"); - } - - var a; - - if(parsed[1]){ - a = parseInt(parsed[1], 10); - if(isNaN(a)){ - if(parsed[1].charAt(0) === "-") a = -1; - else a = 1; - } - } else a = 0; - - return [ - a, - parsed[3] ? parseInt((parsed[2] || "") + parsed[3], 10) : 0 - ]; - } -} |