main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
|
---|
4 | var ToString = require('es-abstract/2024/ToString');
|
---|
5 | var callBound = require('call-bind/callBound');
|
---|
6 | var $replace = callBound('String.prototype.replace');
|
---|
7 |
|
---|
8 | var mvsIsWS = (/^\s$/).test('\u180E');
|
---|
9 | /* eslint-disable no-control-regex */
|
---|
10 | var leftWhitespace = mvsIsWS
|
---|
11 | ? /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/
|
---|
12 | : /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/;
|
---|
13 | var rightWhitespace = mvsIsWS
|
---|
14 | ? /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/
|
---|
15 | : /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;
|
---|
16 | /* eslint-enable no-control-regex */
|
---|
17 |
|
---|
18 | module.exports = function trim() {
|
---|
19 | var S = ToString(RequireObjectCoercible(this));
|
---|
20 | return $replace($replace(S, leftWhitespace, ''), rightWhitespace, '');
|
---|
21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.