Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | export function merge(...sets) {
|
---|
2 | if (sets.length > 1) {
|
---|
3 | sets[0] = sets[0].slice(0, -1);
|
---|
4 | const xl = sets.length - 1;
|
---|
5 | for (let x = 1; x < xl; ++x) {
|
---|
6 | sets[x] = sets[x].slice(1, -1);
|
---|
7 | }
|
---|
8 | sets[xl] = sets[xl].slice(1);
|
---|
9 | return sets.join('');
|
---|
10 | }
|
---|
11 | else {
|
---|
12 | return sets[0];
|
---|
13 | }
|
---|
14 | }
|
---|
15 | export function subexp(str) {
|
---|
16 | return "(?:" + str + ")";
|
---|
17 | }
|
---|
18 | export function typeOf(o) {
|
---|
19 | return o === undefined ? "undefined" : (o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase());
|
---|
20 | }
|
---|
21 | export function toUpperCase(str) {
|
---|
22 | return str.toUpperCase();
|
---|
23 | }
|
---|
24 | export function toArray(obj) {
|
---|
25 | return obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];
|
---|
26 | }
|
---|
27 | export function assign(target, source) {
|
---|
28 | const obj = target;
|
---|
29 | if (source) {
|
---|
30 | for (const key in source) {
|
---|
31 | obj[key] = source[key];
|
---|
32 | }
|
---|
33 | }
|
---|
34 | return obj;
|
---|
35 | }
|
---|
36 | //# sourceMappingURL=util.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.