1 | function trimLeft(str) {
|
2 | return str.replace(/(^\s*)/g, "")
|
3 | }
|
4 |
|
5 | function trimRight(str) {
|
6 | return str.replace(/(\s*$)/g, "")
|
7 | }
|
8 |
|
9 | function trim(str) {
|
10 | return str.replace(/(^\s*)|(\s*$)/g, "")
|
11 | }
|
12 |
|
13 | function toJson(str) {
|
14 | return (new Function("return " + str))()
|
15 | }
|
16 |
|
17 | export default {
|
18 | trimLeft,
|
19 | trimRight,
|
20 | trim,
|
21 | toJson
|
22 | } |
\ | No newline at end of file |