Skip to content

Commit 193b44b

Browse files
committed
[minor] Simplify whitespace regex
1 parent 319851b commit 193b44b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ var required = require('requires-port')
66
, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//
77
, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i
88
, windowsDriveLetter = /^[a-zA-Z]:/
9-
, whitespace = '[\\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]'
10-
, left = new RegExp('^'+ whitespace +'+');
9+
, whitespace = /^[ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;
1110

1211
/**
1312
* Trim a given string.
@@ -16,7 +15,7 @@ var required = require('requires-port')
1615
* @public
1716
*/
1817
function trimLeft(str) {
19-
return (str ? str : '').toString().replace(left, '');
18+
return (str ? str : '').toString().replace(whitespace, '');
2019
}
2120

2221
/**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy