kopia lustrzana https://github.com/c9/core
add shim for trimRight
rodzic
b315a23f74
commit
18dea5502f
|
@ -159,10 +159,6 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function trimRight(str) {
|
|
||||||
return str.replace(/\s+$/, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- npm Management ----- */
|
/* -- npm Management ----- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,8 +203,8 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
if (err) return callback(err, stdout, err.message);
|
if (err) return callback(err, stdout, err.message);
|
||||||
|
|
||||||
stdout = trimRight(stdout);
|
stdout = stdout.trimRight();
|
||||||
stderr = trimRight(stderr);
|
stderr = stderr.trimRight();
|
||||||
|
|
||||||
callback(null, stdout, stderr);
|
callback(null, stdout, stderr);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2978,9 +2978,25 @@ String.prototype.uCaseFirst = function(){
|
||||||
*
|
*
|
||||||
* @type {String}
|
* @type {String}
|
||||||
*/
|
*/
|
||||||
String.prototype.trim = function(){
|
if (!String.prototype.trim) {
|
||||||
return this.replace(/[\s\n\r]*$/, "").replace(/^[\s\n\r]*/, "");
|
String.prototype.trim = function(){
|
||||||
};
|
return this.replace(/\s+$/, "").replace(/^\s+/, "");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* annex b, but useful until trimStart/End are implemented by browsers
|
||||||
|
*/
|
||||||
|
if (!String.prototype.trimLeft) {
|
||||||
|
String.prototype.trimLeft = function(){
|
||||||
|
return this.replace(/^\s+/, "");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.prototype.trimRight) {
|
||||||
|
String.prototype.trimRight = function(){
|
||||||
|
return this.replace(/\s+$/, "");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Concatenate a string with itself n-times.
|
* Concatenate a string with itself n-times.
|
||||||
|
|
Ładowanie…
Reference in New Issue