-
Notifications
You must be signed in to change notification settings - Fork 0
/
noski.core.js
40 lines (34 loc) · 1 KB
/
noski.core.js
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
var noski;
if (!noski) noski = {};
else if (typeof noski != 'object') {
throw new Error('noski already exists and is not an object');
}
if (!noski.core) noski.core = {};
else if (typeof noski.core != 'object') {
throw new Error('noski.core already exists and is not an object');
}
noski.core = function () {
return {
/**
* Trim leading white space from the front of a string
* @param {string} str The string to trim.
*/
ltrim: function (str) {
return str.replace(/^\s\s*/, '');
},
/**
* Trim leading white space from the end of a string
* @param {string} str The string to trim.
*/
rtrim: function (str) {
return str.replace(/\s\s*$/, '');
},
/**
* Trim leading and trailing white space from a string
* @param {string} str The string to trim.
*/
trim: function (str) {
return this.rtrim(this.ltrim(str));
}
};
}();