mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-25 06:13:44 +00:00
refactor(angular.js): improve trim performance
According to Flagrant Badassery's blog http://blog.stevenlevithan.com/archives/faster-trim-javascript and this comparison http://jsperf.com/trim-function, this trim method is faster. Closes #4406
This commit is contained in:
parent
b08427dde9
commit
c2e45c769e
1 changed files with 1 additions and 1 deletions
|
|
@ -544,7 +544,7 @@ var trim = (function() {
|
||||||
// TODO: we should move this into IE/ES5 polyfill
|
// TODO: we should move this into IE/ES5 polyfill
|
||||||
if (!String.prototype.trim) {
|
if (!String.prototype.trim) {
|
||||||
return function(value) {
|
return function(value) {
|
||||||
return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
|
return isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return function(value) {
|
return function(value) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue