diff --git a/lib/optparse.js b/lib/optparse.js index 32ef1c6..78cdfb2 100755 --- a/lib/optparse.js +++ b/lib/optparse.js @@ -5,7 +5,7 @@ // See README.md for license. // var optparse = {}; -try{ optparse = exports } catch(e) {}; // Try to export the lib for node.js +try{ optparse = exports } catch(e) {}; // Try to export the lib for Node.js (function(self) { var VERSION = '1.0.3'; var LONG_SWITCH_RE = /^--\w/; @@ -16,7 +16,7 @@ var EMAIL_RE = /^([0-9a-zA-Z]+([_.-]?[0-9a-zA-Z]+)*@[0-9a-zA-Z]+[0-9,a-z,A-Z,.,- var EXT_RULE_RE = /(\-\-[\w_-]+)\s+([\w\[\]_-]+)|(\-\-[\w_-]+)/; var ARG_OPTIONAL_RE = /\[(.+)\]/; -// The default switch argument filter to use, when argument name doesnt match +// The default switch argument filter to use, when argument name doesn’t match // any other names. var DEFAULT_FILTER = '_DEFAULT'; var PREDEFINED_FILTERS = {}; @@ -26,8 +26,8 @@ function filter_text(value) { return value; } -// Switch argument filter that expects an integer, HEX or a decimal value. An -// exception is throwed if the criteria is not matched. +// Switch argument filter that expects an integer, hex, or a decimal value. An +// exception is thrown if the criteria is not matched. // Valid input formats are: 0xFFFFFFF, 12345 and 1234.1234 function filter_number(value) { var m = NUMBER_RE.exec(value); @@ -36,14 +36,14 @@ function filter_number(value) { // The number is in HEX format. Convert into a number, then return it return parseInt(m[1], 16); } else { - // The number is in regular- or decimal form. Just run in through + // The number is in regular or decimal form. Just run in through // the float caster. return parseFloat(m[2] || m[3]); } }; // Switch argument filter that expects a Date expression. The date string MUST be -// formated as: "yyyy-mm-dd" An exception is throwed if the criteria is not +// formated as: "yyyy-mm-dd" An exception is thrown if the criteria is not // matched. An DATE object is returned on success. function filter_date(value) { var m = DATE_RE.exec(value); @@ -51,7 +51,7 @@ function filter_date(value) { return new Date(parseInt(m[0]), parseInt(m[1]) - 1, parseInt(m[2])); }; -// Switch argument filter that expects an email address. An exception is throwed +// Switch argument filter that expects an email address. An exception is thrown // if the criteria doesn`t match. function filter_email(value) { var m = EMAIL_RE.exec(value); @@ -135,7 +135,7 @@ function build_rule(filters, short, expr, desc) { } } -// Loop's trough all elements of an array and check if there is valid +// Loops through all elements of an array and check if there is valid // options expression within. An valid option is a token that starts // double dashes. E.G. --my_option function contains_expr(arr) { @@ -210,7 +210,7 @@ OptionParser.prototype = { } }, - // Adds a custom filter to the parser. It's possible to override the + // Adds a custom filter to the parser. It’s possible to override the // default filter by passing the value "_DEFAULT" to the ´´name´´ // argument. The name of the filter is automatically transformed into // upper case.