Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
utf8mb4
Commit Description:
utf8mb4
'use strict' ;
var trimStart = require ( 'string.prototype.trimleft' );
var trimEnd = require ( 'string.prototype.trimright' );
var GetIntrinsic = require ( '../GetIntrinsic' );
var $TypeError = GetIntrinsic ( '%TypeError%' );
var RequireObjectCoercible = require ( './RequireObjectCoercible' );
var ToString = require ( './ToString' );
// https://ecma-international.org/ecma-262/10.0/#sec-trimstring
module . exports = function TrimString ( string , where ) {
var str = RequireObjectCoercible ( string );
var S = ToString ( str );
var T ;
if ( where === 'start' ) {
T = trimStart ( S );
} else if ( where === 'end' ) {
T = trimEnd ( S );
} else if ( where === 'start+end' ) {
T = trimStart ( trimEnd ( S ));
} else {
throw new $TypeError ( 'Assertion failed: invalid `where` value; must be "start", "end", or "start+end"' );
}
return T ;
};
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings