Skip to content

Commit

Permalink
[UPDATE] change options to opts. [FIX] fcn documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Mar 21, 2015
1 parent c2fbfde commit 9ba3bba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@ var isArray = require( 'validate.io-array' ),
*
* @param {Array} arr - input array
* @param {Object} [options] - function options
* @param {Boolean} [opts.bias=false] - boolean indicating whether to calculate a biased or unbiased estimate of the variance
* @param {Boolean} [options.bias=false] - boolean indicating whether to calculate a biased or unbiased estimate of the variance
* @param {Function} [options.accessor] - accessor function for accessing array values
* @returns {Number|null} variance or null
*/
function variance( arr, options ) {
function variance( arr, opts ) {
var bias = false,
clbk;
if ( !isArray( arr ) ) {
throw new TypeError( 'variance()::invalid input argument. Must provide an array. Value: `' + arr + '`.' );
}
if ( arguments.length > 1 ) {
if ( !isObject( options ) ) {
throw new TypeError( 'variance()::invalid input argument. Options must be an object. Value: `' + options + '`.' );
if ( !isObject( opts ) ) {
throw new TypeError( 'variance()::invalid input argument. Options must be an object. Value: `' + opts + '`.' );
}
if ( options.hasOwnProperty( 'bias' ) ) {
bias = options.bias;
if ( opts.hasOwnProperty( 'bias' ) ) {
bias = opts.bias;
if ( !isBoolean( bias ) ) {
throw new TypeError( 'variance()::invalid option. Bias option must be a boolean primitive. Value: `' + bias + '`.' );
}
}
if ( options.hasOwnProperty( 'accessor' ) ) {
clbk = options.accessor;
if ( opts.hasOwnProperty( 'accessor' ) ) {
clbk = opts.accessor;
if ( !isFunction( clbk ) ) {
throw new TypeError( 'variance()::invalid option. Accessor must be a function. Value: `' + clbk + '`.' );
}
Expand Down

0 comments on commit 9ba3bba

Please sign in to comment.