1 | "use strict";
|
2 |
|
3 | function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
|
4 |
|
5 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
6 |
|
7 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
8 |
|
9 | var list = require('postcss').list;
|
10 |
|
11 | module.exports = {
|
12 | |
13 |
|
14 |
|
15 |
|
16 | error: function error(text) {
|
17 | var err = new Error(text);
|
18 | err.autoprefixer = true;
|
19 | throw err;
|
20 | },
|
21 |
|
22 | |
23 |
|
24 |
|
25 | uniq: function uniq(array) {
|
26 | var filtered = [];
|
27 |
|
28 | for (var _iterator = _createForOfIteratorHelperLoose(array), _step; !(_step = _iterator()).done;) {
|
29 | var i = _step.value;
|
30 |
|
31 | if (!filtered.includes(i)) {
|
32 | filtered.push(i);
|
33 | }
|
34 | }
|
35 |
|
36 | return filtered;
|
37 | },
|
38 |
|
39 | |
40 |
|
41 |
|
42 | removeNote: function removeNote(string) {
|
43 | if (!string.includes(' ')) {
|
44 | return string;
|
45 | }
|
46 |
|
47 | return string.split(' ')[0];
|
48 | },
|
49 |
|
50 | |
51 |
|
52 |
|
53 | escapeRegexp: function escapeRegexp(string) {
|
54 | return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&');
|
55 | },
|
56 |
|
57 | |
58 |
|
59 |
|
60 | regexp: function regexp(word, escape) {
|
61 | if (escape === void 0) {
|
62 | escape = true;
|
63 | }
|
64 |
|
65 | if (escape) {
|
66 | word = this.escapeRegexp(word);
|
67 | }
|
68 |
|
69 | return new RegExp("(^|[\\s,(])(" + word + "($|[\\s(,]))", 'gi');
|
70 | },
|
71 |
|
72 | |
73 |
|
74 |
|
75 | editList: function editList(value, callback) {
|
76 | var origin = list.comma(value);
|
77 | var changed = callback(origin, []);
|
78 |
|
79 | if (origin === changed) {
|
80 | return value;
|
81 | }
|
82 |
|
83 | var join = value.match(/,\s*/);
|
84 | join = join ? join[0] : ', ';
|
85 | return changed.join(join);
|
86 | },
|
87 |
|
88 | |
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | splitSelector: function splitSelector(selector) {
|
97 | return list.comma(selector).map(function (i) {
|
98 | return list.space(i).map(function (k) {
|
99 | return k.split(/(?=\.|#)/g);
|
100 | });
|
101 | });
|
102 | }
|
103 | }; |
\ | No newline at end of file |