forked from Unisay/purescript-lua-strings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.js
More file actions
52 lines (45 loc) · 1.04 KB
/
Common.js
File metadata and controls
52 lines (45 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
export const _localeCompare = function (lt) {
return function (eq) {
return function (gt) {
return function (s1) {
return function (s2) {
var result = s1.localeCompare(s2);
return result < 0 ? lt : result > 0 ? gt : eq;
};
};
};
};
};
export const replace = function (s1) {
return function (s2) {
return function (s3) {
return s3.replace(s1, s2);
};
};
};
export const replaceAll = function (s1) {
return function (s2) {
return function (s3) {
return s3.replace(new RegExp(s1.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), "g"), s2); // eslint-disable-line no-useless-escape
};
};
};
export const split = function (sep) {
return function (s) {
return s.split(sep);
};
};
export const toLower = function (s) {
return s.toLowerCase();
};
export const toUpper = function (s) {
return s.toUpperCase();
};
export const trim = function (s) {
return s.trim();
};
export const joinWith = function (s) {
return function (xs) {
return xs.join(s);
};
};