Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace the reserved word `char`

  • Loading branch information...
commit d9a391db9d14f19ebe6c698c02ff74e3bc6cfacd 1 parent 3a5288d
@ben-ng ben-ng authored
Showing with 22 additions and 22 deletions.
  1. +1 −1  lib/file.js
  2. +21 −21 lib/string.js
View
2  lib/file.js
@@ -376,7 +376,7 @@ var fileUtils = new (function () {
@name file#isAbsolute
@public
@function
- @return {Boolean/String} If it's absolute the first char is returned otherwise false
+ @return {Boolean/String} If it's absolute the first character is returned otherwise false
@description Checks if a given path is absolute or relative
@param {String} p Path to check
*/
View
42 lib/string.js
@@ -165,11 +165,11 @@ string = new (function () {
@description Ltrim trims `char` from the left of a `string` and returns it
if no `char` is given it will trim spaces
@param {String} string The string to trim
- @param {String} char The character to trim
+ @param {String} character The character to trim
*/
- this.ltrim = function (string, char) {
+ this.ltrim = function (string, character) {
var str = string || ''
- , pat = char ? new RegExp('^' + char + '+') : _LTR;
+ , pat = character ? new RegExp('^' + character + '+') : _LTR;
str = String(str);
return str.replace(pat, '');
@@ -183,11 +183,11 @@ string = new (function () {
@description Rtrim trims `char` from the right of a `string` and returns it
if no `char` is given it will trim spaces
@param {String} string The string to trim
- @param {String} char The character to trim
+ @param {String} character The character to trim
*/
- this.rtrim = function (string, char) {
+ this.rtrim = function (string, character) {
var str = string || ''
- , pat = char ? new RegExp(char + '+$') : _RTR;
+ , pat = character ? new RegExp(character + '+$') : _RTR;
str = String(str);
return str.replace(pat, '');
@@ -204,11 +204,11 @@ string = new (function () {
@description Trim trims `char` from the left and right of a `string` and returns it
if no `char` is given it will trim spaces
@param {String} string The string to trim
- @param {String} char The character to trim
+ @param {String} character The character to trim
*/
- this.trim = function (string, char) {
+ this.trim = function (string, character) {
var str = string || ''
- , pat = char ? new RegExp('^' + char + '+|' + char + '+$', 'g') : _TR;
+ , pat = character ? new RegExp('^' + character + '+|' + character + '+$', 'g') : _TR;
str = String(str);
return str.replace(pat, '');
@@ -249,20 +249,20 @@ string = new (function () {
@description Lpad adds `char` to the left of `string` until the length
of `string` is more than `width`
@param {String} string The string to pad
- @param {String} char The character to pad with
+ @param {String} character The character to pad with
@param {Number} width the width to pad to
*/
- this.lpad = function (string, char, width) {
+ this.lpad = function (string, character, width) {
var str = string || ''
, width;
str = String(str);
// Should width be string.length + 1? or the same to be safe
width = parseInt(width, 10) || str.length;
- char = char || ' ';
+ character = character || ' ';
while (str.length < width) {
- str = char + str;
+ str = character + str;
}
return str;
};
@@ -275,20 +275,20 @@ string = new (function () {
@description Rpad adds `char` to the right of `string` until the length
of `string` is more than `width`
@param {String} string The string to pad
- @param {String} char The character to pad with
+ @param {String} character The character to pad with
@param {Number} width the width to pad to
*/
- this.rpad = function (string, char, width) {
+ this.rpad = function (string, character, width) {
var str = string || ''
, width;
str = String(str);
// Should width be string.length + 1? or the same to be safe
width = parseInt(width, 10) || str.length;
- char = char || ' ';
+ character = character || ' ';
while (str.length < width) {
- str += char;
+ str += character;
}
return str;
};
@@ -301,20 +301,20 @@ string = new (function () {
@description Pad adds `char` to the left and right of `string` until the length
of `string` is more than `width`
@param {String} string The string to pad
- @param {String} char The character to pad with
+ @param {String} character The character to pad with
@param {Number} width the width to pad to
*/
- this.pad = function (string, char, width) {
+ this.pad = function (string, character, width) {
var str = string || ''
, width;
str = String(str);
// Should width be string.length + 1? or the same to be safe
width = parseInt(width, 10) || str.length;
- char = char || ' ';
+ character = character || ' ';
while (str.length < width) {
- str = char + str + char;
+ str = character + str + character;
}
return str;
};
Please sign in to comment.
Something went wrong with that request. Please try again.