Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
31 changes: 16 additions & 15 deletions lib/node_modules/@stdlib/_tools/github/create-repo/lib/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,22 @@ function factory( options, clbk ) {
throw new TypeError( format( 'invalid argument. Repository name must be a string. Value: `%s`.', name ) );
}
query( name, opts, done );
/**
* Callback invoked after receiving an API response.
*
* @private
* @param {(Error|null)} error - error object
* @param {ObjectArray} data - query data
* @param {Object} info - response info
* @returns {void}
*/
function done( error, data, info ) {
error = error || null;
data = data || null;
info = info || null;
clbk( error, data, info );
}
}

/**
* Callback invoked after receiving an API response.
*
* @private
* @param {(Error|null)} error - error object
* @param {ObjectArray} data - query data
* @param {Object} info - response info
* @returns {void}
*/
function done( error, data, info ) {
error = error || null;
data = data || null;
info = info || null;
clbk( error, data, info );
}
}

Expand Down
22 changes: 17 additions & 5 deletions lib/node_modules/@stdlib/assert/is-method/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@

var isMethod = require( './../lib' );

var bool = isMethod( { 'a': isMethod }, 'a' );
var obj = {
'a': isMethod
};
var bool = isMethod( obj, 'a' );
console.log( bool );
// => true

bool = isMethod( { 'a': 'b' }, 'a' );
obj = {
'a': 'b'
};
bool = isMethod( obj, 'a' );
console.log( bool );
// => false

bool = isMethod( { 'a': 'b' }, null );
bool = isMethod( obj, null );
console.log( bool );
// => false

Expand All @@ -46,10 +52,16 @@ bool = isMethod( void 0, 'a' );
console.log( bool );
// => false

bool = isMethod( { 'null': isMethod }, null );
obj = {
'null': isMethod
};
bool = isMethod( obj, null );
console.log( bool );
// => true

bool = isMethod( { '[object Object]': isMethod }, {} );
obj = {
'[object Object]': isMethod
};
bool = isMethod( obj, {} );
console.log( bool );
// => true
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var randu = require( '@stdlib/random/base/randu' );
var floor = require( '@stdlib/math/base/special/floor' );
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var zeros = require( '@stdlib/array/base/zeros' );
var isArray = require( '@stdlib/assert/is-array' );
var pkg = require( './../package.json' ).name;
var shape2strides = require( './../lib' );
Expand All @@ -36,14 +35,13 @@ bench( pkg+':order=row-major', function benchmark( b ) {
var out;
var i;

shape = [ 0, 0, 0 ];
shape[ 0 ] = discreteUniform( 0, 10 );
shape[ 1 ] = discreteUniform( 0, 10 );
shape[ 2 ] = discreteUniform( 0, 10 );
shape = discreteUniform( 3, 0, 10, {
'dtype': 'generic'
});

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
shape[ 0 ] = floor( randu()*10 );
shape[ 0 ] += 1;
out = shape2strides( shape, 'row-major' );
if ( out.length !== shape.length ) {
b.fail( 'should have expected length' );
Expand All @@ -62,14 +60,13 @@ bench( pkg+':order=column-major', function benchmark( b ) {
var out;
var i;

shape = [ 0, 0, 0 ];
shape[ 0 ] = floor( randu()*10 );
shape[ 1 ] = floor( randu()*10 );
shape[ 2 ] = floor( randu()*10 );
shape = discreteUniform( 3, 0, 10, {
'dtype': 'generic'
});

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
shape[ 0 ] = floor( randu()*10 );
shape[ 0 ] += 1;
out = shape2strides( shape, 'column-major' );
if ( out.length !== shape.length ) {
b.fail( 'should have expected length' );
Expand All @@ -88,16 +85,15 @@ bench( pkg+':assign:order=row-major', function benchmark( b ) {
var out;
var i;

shape = [ 0, 0, 0 ];
shape[ 0 ] = floor( randu()*10 );
shape[ 1 ] = floor( randu()*10 );
shape[ 2 ] = floor( randu()*10 );
shape = discreteUniform( 3, 0, 10, {
'dtype': 'generic'
});

out = new Array( shape.length );
out = zeros( shape.length );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
shape[ 0 ] = floor( randu()*10 );
shape[ 0 ] += 1;
out = shape2strides.assign( shape, 'row-major', out );
if ( out.length !== shape.length ) {
b.fail( 'should have expected length' );
Expand All @@ -116,16 +112,15 @@ bench( pkg+':assign:order=column-major', function benchmark( b ) {
var out;
var i;

shape = [ 0, 0, 0 ];
shape[ 0 ] = floor( randu()*10 );
shape[ 1 ] = floor( randu()*10 );
shape[ 2 ] = floor( randu()*10 );
shape = discreteUniform( 3, 0, 10, {
'dtype': 'generic'
});

out = new Array( shape.length );
out = zeros( shape.length );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
shape[ 0 ] = floor( randu()*10 );
shape[ 0 ] += 1;
out = shape2strides.assign( shape, 'column-major', out );
if ( out.length !== shape.length ) {
b.fail( 'should have expected length' );
Expand Down
Loading