diff --git a/.npmrc b/.npmrc index 36f5bef4..5af90674 100644 --- a/.npmrc +++ b/.npmrc @@ -26,3 +26,6 @@ shrinkwrap = false # Disable automatically "saving" dependencies on install: save = false + +# Generate provenance metadata: +provenance = true diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d7b90d54..554fdde9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,26 +2,28 @@ # # Contributors listed in alphabetical order. -Adarsh Palaskar <83298237+adarshpalaskar1@users.noreply.github.com> -Aditya Sapra <110766802+adityacodes30@users.noreply.github.com> +Adarsh Palaskar +Aditya Sapra AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com> Ali Salesi -Aman Bhansali <92033532+aman-095@users.noreply.github.com> +Aman Bhansali Amit Jimiwal -Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> +Anudeep Sanapala Athan Reines Brendan Graetz Bruno Fenzl -Chinmay J <86140365+JawHawk@users.noreply.github.com> +Chinmay Joshi <86140365+JawHawk@users.noreply.github.com> Christopher Dambamuromo Dan Rose Daniel Killenberger Dominik Moritz Dorrin Sotoudeh +EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com> Frank Kovacs -GUNJ JOSHI -Golden <103646877+AuenKr@users.noreply.github.com> +Golden Kumar <103646877+AuenKr@users.noreply.github.com> +Gunj Joshi Harshita Kalani +Jaimin Godhani <112328542+Jai0401@users.noreply.github.com> James Gelok Jaysukh Makvana Jithin KS @@ -32,6 +34,7 @@ Justin Dennison Karthik Prakash <116057817+skoriop@users.noreply.github.com> Khaldon Lovelin <100030865+lovelindhoni@users.noreply.github.com> +Manik Sharma Marcus Fantham Matt Cochrane Mihir Pandit <129577900+MSP20086@users.noreply.github.com> @@ -47,6 +50,7 @@ Pranav Goswami Praneki <97080887+PraneGIT@users.noreply.github.com> Pratik <97464067+Pratik772846@users.noreply.github.com> Priyansh <88396544+itsspriyansh@users.noreply.github.com> +Raunak Kumar Gupta Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com> Ricky Reusser Robert Gislason @@ -55,14 +59,16 @@ Rutam <138517416+performant23@users.noreply.github.com> Ryan Seal Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com> Seyyed Parsa Neshaei -Shashank Shekhar Singh <123410790+Shashankss1205@users.noreply.github.com> +Shashank Shekhar Singh Shraddheya Shendre -Shubham +Shubham Mishra Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com> -Spandan Barve <114365550+marsian83@users.noreply.github.com> +Spandan Barve Stephannie Jiménez Gacha -Utkarsh <137638507+Ut-the-pro@users.noreply.github.com> +Utkarsh +Utkarsh Raj +Varad Gupta Yernar Yergaziyev +nishant-s7 <97207366+nishant-s7@users.noreply.github.com> orimiles5 <97595296+orimiles5@users.noreply.github.com> rei2hu -utkarsh_raj <49344502+rajutkarsh07@users.noreply.github.com> diff --git a/is-nonnegative-finite/benchmark/benchmark.js b/is-nonnegative-finite/benchmark/benchmark.js index 47458e39..434a4771 100644 --- a/is-nonnegative-finite/benchmark/benchmark.js +++ b/is-nonnegative-finite/benchmark/benchmark.js @@ -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, @@ -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; @@ -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(); @@ -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, @@ -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; @@ -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(); @@ -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; @@ -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; @@ -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 ) ]; diff --git a/is-nonnegative-finite/docs/repl.txt b/is-nonnegative-finite/docs/repl.txt index 20cef100..a9c31076 100644 --- a/is-nonnegative-finite/docs/repl.txt +++ b/is-nonnegative-finite/docs/repl.txt @@ -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 @@ -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 @@ -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 diff --git a/is-nonnegative-finite/docs/types/test.ts b/is-nonnegative-finite/docs/types/test.ts index 22b80824..e5b6c039 100644 --- a/is-nonnegative-finite/docs/types/test.ts +++ b/is-nonnegative-finite/docs/types/test.ts @@ -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 diff --git a/is-nonnegative-finite/test/test.main.js b/is-nonnegative-finite/test/test.main.js index 3b331d86..c21a7292 100644 --- a/is-nonnegative-finite/test/test.main.js +++ b/is-nonnegative-finite/test/test.main.js @@ -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(); }); @@ -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(); }); diff --git a/is-nonnegative-finite/test/test.object.js b/is-nonnegative-finite/test/test.object.js index 04634f55..4e629c33 100644 --- a/is-nonnegative-finite/test/test.object.js +++ b/is-nonnegative-finite/test/test.object.js @@ -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(); }); @@ -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(); }); diff --git a/is-nonnegative-finite/test/test.primitive.js b/is-nonnegative-finite/test/test.primitive.js index c591b193..033d352c 100644 --- a/is-nonnegative-finite/test/test.primitive.js +++ b/is-nonnegative-finite/test/test.primitive.js @@ -34,22 +34,22 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function returns `true` if provided a primitive number having a nonnegative finite value', function test( t ) { - t.equal( isNonNegativeFinite( 3.0 ), true, 'returns true' ); + t.equal( isNonNegativeFinite( 3.0 ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `false` if provided a number object, even if the number has a nonnegative finite value', function test( t ) { - t.equal( isNonNegativeFinite( new Number( 5.0 ) ), false, 'returns false' ); + t.equal( isNonNegativeFinite( new Number( 5.0 ) ), false, '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 a number object with 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(); }); @@ -70,7 +70,7 @@ tape( 'the function returns `false` if not provided a nonnegative finite number' ]; 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(); });