summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJérémy Faivre <jeremy.faivre@gmail.com>2015-07-22 17:49:10 +0200
committerJérémy Faivre <jeremy.faivre@gmail.com>2015-07-22 17:49:10 +0200
commitae76912a41a6de899e7d869cf44d2f04995e43f4 (patch)
treee7d3cb2c926670788acd1e9226bd6320c969fd24 /src
parent42e1d52ec2f1561c7a446a323478964904650c52 (diff)
parent7b12c5a5c5bf8fbf89a73e67f5b08e75904435d7 (diff)
downloadyamljs-ae76912a41a6de899e7d869cf44d2f04995e43f4.tar.gz
Merge pull request #26 from phpdave11/develop
Replaced reserved javascript keyword "char" with "_char"
Diffstat (limited to 'src')
-rw-r--r--src/Pattern.coffee12
-rw-r--r--src/Utils.coffee28
2 files changed, 20 insertions, 20 deletions
diff --git a/src/Pattern.coffee b/src/Pattern.coffee
index ada37b2..e65fa79 100644
--- a/src/Pattern.coffee
+++ b/src/Pattern.coffee
@@ -29,12 +29,12 @@ class Pattern
capturingBracketNumber = 0
i = 0
while i < len
- char = rawRegex.charAt(i)
- if char is '\\'
+ _char = rawRegex.charAt(i)
+ if _char is '\\'
# Ignore next character
cleanedRegex += rawRegex[i..i+1]
i++
- else if char is '('
+ else if _char is '('
# Increase bracket number, only if it is capturing
if i < len - 2
part = rawRegex[i..i+2]
@@ -62,12 +62,12 @@ class Pattern
i++
else
- cleanedRegex += char
+ cleanedRegex += _char
capturingBracketNumber++
else
- cleanedRegex += char
+ cleanedRegex += _char
else
- cleanedRegex += char
+ cleanedRegex += _char
i++
diff --git a/src/Utils.coffee b/src/Utils.coffee
index a78fd39..eb315ce 100644
--- a/src/Utils.coffee
+++ b/src/Utils.coffee
@@ -32,19 +32,19 @@ class Utils
# Trims the given string on both sides
#
# @param [String] str The string to trim
- # @param [String] char The character to use for trimming (default: '\\s')
+ # @param [String] _char The character to use for trimming (default: '\\s')
#
# @return [String] A trimmed string
#
- @trim: (str, char = '\\s') ->
+ @trim: (str, _char = '\\s') ->
return str.trim()
- regexLeft = @REGEX_LEFT_TRIM_BY_CHAR[char]
+ regexLeft = @REGEX_LEFT_TRIM_BY_CHAR[_char]
unless regexLeft?
- @REGEX_LEFT_TRIM_BY_CHAR[char] = regexLeft = new RegExp '^'+char+''+char+'*'
+ @REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp '^'+_char+''+_char+'*'
regexLeft.lastIndex = 0
- regexRight = @REGEX_RIGHT_TRIM_BY_CHAR[char]
+ regexRight = @REGEX_RIGHT_TRIM_BY_CHAR[_char]
unless regexRight?
- @REGEX_RIGHT_TRIM_BY_CHAR[char] = regexRight = new RegExp char+''+char+'*$'
+ @REGEX_RIGHT_TRIM_BY_CHAR[_char] = regexRight = new RegExp _char+''+_char+'*$'
regexRight.lastIndex = 0
return str.replace(regexLeft, '').replace(regexRight, '')
@@ -52,14 +52,14 @@ class Utils
# Trims the given string on the left side
#
# @param [String] str The string to trim
- # @param [String] char The character to use for trimming (default: '\\s')
+ # @param [String] _char The character to use for trimming (default: '\\s')
#
# @return [String] A trimmed string
#
- @ltrim: (str, char = '\\s') ->
- regexLeft = @REGEX_LEFT_TRIM_BY_CHAR[char]
+ @ltrim: (str, _char = '\\s') ->
+ regexLeft = @REGEX_LEFT_TRIM_BY_CHAR[_char]
unless regexLeft?
- @REGEX_LEFT_TRIM_BY_CHAR[char] = regexLeft = new RegExp '^'+char+''+char+'*'
+ @REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp '^'+_char+''+_char+'*'
regexLeft.lastIndex = 0
return str.replace(regexLeft, '')
@@ -67,14 +67,14 @@ class Utils
# Trims the given string on the right side
#
# @param [String] str The string to trim
- # @param [String] char The character to use for trimming (default: '\\s')
+ # @param [String] _char The character to use for trimming (default: '\\s')
#
# @return [String] A trimmed string
#
- @rtrim: (str, char = '\\s') ->
- regexRight = @REGEX_RIGHT_TRIM_BY_CHAR[char]
+ @rtrim: (str, _char = '\\s') ->
+ regexRight = @REGEX_RIGHT_TRIM_BY_CHAR[_char]
unless regexRight?
- @REGEX_RIGHT_TRIM_BY_CHAR[char] = regexRight = new RegExp char+''+char+'*$'
+ @REGEX_RIGHT_TRIM_BY_CHAR[_char] = regexRight = new RegExp _char+''+_char+'*$'
regexRight.lastIndex = 0
return str.replace(regexRight, '')