Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some grammar fixes in JS comments #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/optparse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/;
Expand All @@ -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 = {};
Expand All @@ -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);
Expand All @@ -36,22 +36,22 @@ 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);
if(m == null) throw OptError('Expected a date representation in the "yyyy-mm-dd" format.');
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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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. Its 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.
Expand Down