-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,19 @@ | ||
import trimmedEndIndex from './_trimmedEndIndex.js'; | ||
|
||
/** Used to match leading whitespace. */ | ||
var reTrimStart = /^\s /; | ||
|
||
/** | ||
* The base implementation of `_.trim`. | ||
* | ||
* @private | ||
* @param {string} string The string to trim. | ||
* @returns {string} Returns the trimmed string. | ||
*/ | ||
function baseTrim(string) { | ||
return string | ||
? string.slice(0, trimmedEndIndex(string) 1).replace(reTrimStart, '') | ||
: string; | ||
} | ||
|
||
export default baseTrim; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,19 @@ | ||
/** Used to match a single whitespace character. */ | ||
var reWhitespace = /\s/; | ||
|
||
/** | ||
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace | ||
* character of `string`. | ||
* | ||
* @private | ||
* @param {string} string The string to inspect. | ||
* @returns {number} Returns the index of the last non-whitespace character. | ||
*/ | ||
function trimmedEndIndex(string) { | ||
var index = string.length; | ||
|
||
while (index-- && reWhitespace.test(string.charAt(index))) {} | ||
return index; | ||
} | ||
|
||
export default trimmedEndIndex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters