Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Mar 16, 2024
1 parent 8b4f33c commit b6e912b
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 54 deletions.
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ shrinkwrap = false

# Disable automatically "saving" dependencies on install:
save = false

# Generate provenance metadata:
provenance = true
30 changes: 18 additions & 12 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@
#
# Contributors listed in alphabetical order.

Adarsh Palaskar <[email protected].com>
Aditya Sapra <[email protected].com>
Adarsh Palaskar <adarshpalaskar99@gmail.com>
Aditya Sapra <adityaework@gmail.com>
AgPriyanshu18 <[email protected]>
Ali Salesi <[email protected]>
Aman Bhansali <[email protected]>
Aman Bhansali <[email protected]>
Amit Jimiwal <[email protected]>
Anudeep Sanapala <[email protected].com>
Anudeep Sanapala <anudeep0306@gmail.com>
Athan Reines <[email protected]>
Brendan Graetz <[email protected]>
Bruno Fenzl <[email protected]>
Chinmay J <[email protected]>
Chinmay Joshi <[email protected]>
Christopher Dambamuromo <[email protected]>
Dan Rose <[email protected]>
Daniel Killenberger <[email protected]>
Dominik Moritz <[email protected]>
Dorrin Sotoudeh <[email protected]>
EuniceSim142 <[email protected]>
Frank Kovacs <[email protected]>
GUNJ JOSHI <gunjjoshi8372@gmail.com>
Golden <[email protected].com>
Golden Kumar <[email protected].com>
Gunj Joshi <gunjjoshi8372@gmail.com>
Harshita Kalani <[email protected]>
Jaimin Godhani <[email protected]>
James Gelok <[email protected]>
Jaysukh Makvana <[email protected]>
Jithin KS <[email protected]>
Expand All @@ -32,6 +34,7 @@ Justin Dennison <[email protected]>
Karthik Prakash <[email protected]>
Khaldon <[email protected]>
Lovelin <[email protected]>
Manik Sharma <[email protected]>
Marcus Fantham <[email protected]>
Matt Cochrane <[email protected]>
Mihir Pandit <[email protected]>
Expand All @@ -47,6 +50,7 @@ Pranav Goswami <[email protected]>
Praneki <[email protected]>
Pratik <[email protected]>
Priyansh <[email protected]>
Raunak Kumar Gupta <[email protected]>
Rejoan Sardar <[email protected]>
Ricky Reusser <[email protected]>
Robert Gislason <[email protected]>
Expand All @@ -55,14 +59,16 @@ Rutam <[email protected]>
Ryan Seal <[email protected]>
Sai Srikar Dumpeti <[email protected]>
Seyyed Parsa Neshaei <[email protected]>
Shashank Shekhar Singh <[email protected].com>
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
Shraddheya Shendre <[email protected]>
Shubham <[email protected]>
Shubham Mishra <[email protected]>
Snehil Shah <[email protected]>
Spandan Barve <[email protected]>
Spandan Barve <[email protected]>
Stephannie Jiménez Gacha <[email protected]>
Utkarsh <[email protected]>
Utkarsh <http://[email protected]>
Utkarsh Raj <[email protected]>
Varad Gupta <[email protected]>
Yernar Yergaziyev <[email protected]>
nishant-s7 <[email protected]>
orimiles5 <[email protected]>
rei2hu <[email protected]>
utkarsh_raj <[email protected]>
126 changes: 109 additions & 17 deletions is-nonnegative-finite/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,39 @@ var isNonNegativeFinite = require( './../lib' );

// MAIN //

bench( pkg+'::primitives', function benchmark( b ) {
bench( pkg+'::true,primitives', function benchmark( b ) {
var values;
var bool;
var i;

values = [
'5',
5.0,
4.0,
3.14,
3.14
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
bool = isNonNegativeFinite( values[ i % values.length ] );
if ( typeof bool !== 'boolean' ) {
b.fail( 'should return a boolean' );
}
}
b.toc();
if ( !isBoolean( bool ) ) {
b.fail( 'should return a boolean' );
}
b.pass( 'benchmark finished' );
b.end();
});

bench( pkg+'::false,primitives', function benchmark( b ) {
var values;
var bool;
var i;

values = [
'5',
-5.0,
-4.0,
NaN,
Expand All @@ -69,7 +92,32 @@ bench( pkg+'::primitives', function benchmark( b ) {
b.end();
});

bench( pkg+'::objects', function benchmark( b ) {
bench( pkg+'::true,objects', function benchmark( b ) {
var values;
var bool;
var i;

values = [
new Number( 2.0 ),
new Number( 3.14 )
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
bool = isNonNegativeFinite( values[ i % values.length ] );
if ( typeof bool !== 'boolean' ) {
b.fail( 'should return a boolean' );
}
}
b.toc();
if ( !isBoolean( bool ) ) {
b.fail( 'should return a boolean' );
}
b.pass( 'benchmark finished' );
b.end();
});

bench( pkg+'::false,objects', function benchmark( b ) {
var values;
var bool;
var i;
Expand All @@ -78,9 +126,7 @@ bench( pkg+'::objects', function benchmark( b ) {
[],
{},
function noop() {},
new Number( 2.0 ),
new Number( -3.0 ),
new Number( 3.14 )
new Number( -3.0 )
];

b.tic();
Expand All @@ -98,16 +144,39 @@ bench( pkg+'::objects', function benchmark( b ) {
b.end();
});

bench( pkg+'::primitives:isPrimitive', function benchmark( b ) {
bench( pkg+'::true,primitives:isPrimitive', function benchmark( b ) {
var values;
var bool;
var i;

values = [
'5',
5.0,
4.0,
3.14,
3.14
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
bool = isNonNegativeFinite.isPrimitive( values[ i % values.length ] );
if ( typeof bool !== 'boolean' ) {
b.fail( 'should return a boolean' );
}
}
b.toc();
if ( !isBoolean( bool ) ) {
b.fail( 'should return a boolean' );
}
b.pass( 'benchmark finished' );
b.end();
});

bench( pkg+'::false,primitives:isPrimitive', function benchmark( b ) {
var values;
var bool;
var i;

values = [
'5',
-5.0,
-4.0,
NaN,
Expand All @@ -134,7 +203,7 @@ bench( pkg+'::primitives:isPrimitive', function benchmark( b ) {
b.end();
});

bench( pkg+'::objects:isPrimitive', function benchmark( b ) {
bench( pkg+'::false,objects:isPrimitive', function benchmark( b ) {
var values;
var bool;
var i;
Expand All @@ -144,8 +213,8 @@ bench( pkg+'::objects:isPrimitive', function benchmark( b ) {
{},
function noop() {},
new Number( 2.0 ),
new Number( -3.0 ),
new Number( 3.14 )
new Number( 3.14 ),
new Number( -3.0 )
];

b.tic();
Expand All @@ -163,7 +232,7 @@ bench( pkg+'::objects:isPrimitive', function benchmark( b ) {
b.end();
});

bench( pkg+'::primitives:isObject', function benchmark( b ) {
bench( pkg+'::false,primitives:isObject', function benchmark( b ) {
var values;
var bool;
var i;
Expand Down Expand Up @@ -199,7 +268,32 @@ bench( pkg+'::primitives:isObject', function benchmark( b ) {
b.end();
});

bench( pkg+'::objects:isObject', function benchmark( b ) {
bench( pkg+'::true,objects:isObject', function benchmark( b ) {
var values;
var bool;
var i;

values = [
new Number( 2.0 ),
new Number( 3.14 )
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
bool = isNonNegativeFinite.isObject( values[ i % values.length ] );
if ( typeof bool !== 'boolean' ) {
b.fail( 'should return a boolean' );
}
}
b.toc();
if ( !isBoolean( bool ) ) {
b.fail( 'should return a boolean' );
}
b.pass( 'benchmark finished' );
b.end();
});

bench( pkg+'::false,objects:isObject', function benchmark( b ) {
var values;
var bool;
var i;
Expand All @@ -208,9 +302,7 @@ bench( pkg+'::objects:isObject', function benchmark( b ) {
[],
{},
function noop() {},
new Number( 2.0 ),
new Number( -3.0 ),
new Number( 3.14 ),
new Number( PINF )
];

Expand Down
6 changes: 3 additions & 3 deletions is-nonnegative-finite/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
--------
> var bool = {{alias}}( 5.0 )
true
> bool = {{alias}}( new Number( 5.0 ) )
> bool = {{alias}}( new {{alias:@stdlib/number/ctor}}( 5.0 ) )
true
> bool = {{alias}}( 3.14 )
true
Expand Down Expand Up @@ -46,7 +46,7 @@
--------
> var bool = {{alias}}.isPrimitive( 3.0 )
true
> bool = {{alias}}.isPrimitive( new Number( 3.0 ) )
> bool = {{alias}}.isPrimitive( new {{alias:@stdlib/number/ctor}}( 3.0 ) )
false


Expand All @@ -68,7 +68,7 @@
--------
> var bool = {{alias}}.isObject( 3.0 )
false
> bool = {{alias}}.isObject( new Number( 3.0 ) )
> bool = {{alias}}.isObject( new {{alias:@stdlib/number/ctor}}( 3.0 ) )
true


Expand Down
8 changes: 4 additions & 4 deletions is-nonnegative-finite/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@ import isNonNegativeFinite = require( './index' );
isNonNegativeFinite( 2, 123 ); // $ExpectError
}

// Attached to main export is an isPrimitive method which returns a boolean...
// Attached to main export is an `isPrimitive` method which returns a boolean...
{
// eslint-disable-next-line no-new-wrappers
isNonNegativeFinite.isPrimitive( new Number( 2 ) ); // $ExpectType boolean
isNonNegativeFinite.isPrimitive( 2 ); // $ExpectType boolean
}

// The compiler throws an error if the isPrimitive method is provided an unsupported number of arguments...
// The compiler throws an error if the `isPrimitive` method is provided an unsupported number of arguments...
{
isNonNegativeFinite.isPrimitive(); // $ExpectError
isNonNegativeFinite.isPrimitive( 2, 123 ); // $ExpectError
}

// Attached to main export is an isObject method which returns a boolean...
// Attached to main export is an `isObject` method which returns a boolean...
{
// eslint-disable-next-line no-new-wrappers
isNonNegativeFinite.isObject( new Number( 2 ) ); // $ExpectType boolean
isNonNegativeFinite.isObject( 2 ); // $ExpectType boolean
}

// The compiler throws an error if the isObject method is provided an unsupported number of arguments...
// The compiler throws an error if the `isObject` method is provided an unsupported number of arguments...
{
isNonNegativeFinite.isObject(); // $ExpectError
isNonNegativeFinite.isObject( 2, 123 ); // $ExpectError
Expand Down
8 changes: 4 additions & 4 deletions is-nonnegative-finite/test/test.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ tape( 'main export is a function', function test( t ) {
t.end();
});

tape( 'the function returns `true` if provided a number having a nonnegative number value', function test( t ) {
t.equal( isNonNegativeFinite( 5.0 ), true, 'returns true' );
t.equal( isNonNegativeFinite( new Number( 5.0 ) ), true, 'returns true' );
tape( 'the function returns `true` if provided a number having a nonnegative finite value', function test( t ) {
t.equal( isNonNegativeFinite( 5.0 ), true, 'returns expected value' );
t.equal( isNonNegativeFinite( new Number( 5.0 ) ), true, 'returns expected value' );
t.end();
});

Expand All @@ -58,7 +58,7 @@ tape( 'the function returns `false` if not provided a number having a nonnegativ
];

for ( i = 0; i < values.length; i++ ) {
t.equal( isNonNegativeFinite( values[i] ), false, 'returns false when provided '+values[i] );
t.equal( isNonNegativeFinite( values[i] ), false, 'returns expected value when provided '+values[i] );
}
t.end();
});
14 changes: 7 additions & 7 deletions is-nonnegative-finite/test/test.object.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ tape( 'main export is a function', function test( t ) {
t.end();
});

tape( 'the function returns `true` if provided a number object having a nonnegative number value', function test( t ) {
t.equal( isNonNegativeFinite( new Number( 5.0 ) ), true, 'returns true' );
tape( 'the function returns `true` if provided a number object having a nonnegative finite value', function test( t ) {
t.equal( isNonNegativeFinite( new Number( 5.0 ) ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `false` if provided positive infinity', function test( t ) {
t.equal( isNonNegativeFinite( 1.0/0.0 ), false, 'returns false' );
tape( 'the function returns `false` if provided positive infinity (primitive)', function test( t ) {
t.equal( isNonNegativeFinite( 1.0/0.0 ), false, 'returns expected value' );
t.end();
});

tape( 'the function returns `false` if provided positive infinity', function test( t ) {
t.equal( isNonNegativeFinite( new Number( 1.0/0.0 ) ), false, 'returns false' );
tape( 'the function returns `false` if provided positive infinity (object)', function test( t ) {
t.equal( isNonNegativeFinite( new Number( 1.0/0.0 ) ), false, 'returns expected value' );
t.end();
});

Expand All @@ -68,7 +68,7 @@ tape( 'the function returns `false` if not provided a nonnegative number', funct
];

for ( i = 0; i < values.length; i++ ) {
t.equal( isNonNegativeFinite( values[i] ), false, 'returns false when provided '+values[i] );
t.equal( isNonNegativeFinite( values[i] ), false, 'returns expected value when provided '+values[i] );
}
t.end();
});
Loading

0 comments on commit b6e912b

Please sign in to comment.