diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/README.md b/lib/node_modules/@stdlib/assert/is-negative-finite/README.md new file mode 100644 index 00000000000..f32954d5c7e --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/README.md @@ -0,0 +1,161 @@ + + +# isNegativeFinite + +> Test if a value is a number having a finite negative value. + +
+ +## Usage + +```javascript +var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ); +``` + +#### isNegativeFinite( value ) + +Tests if a `value` is a `number` having a finite negative value. + + + +```javascript +var Number = require( '@stdlib/number/ctor' ); + +var bool = isNegativeFinite( -5.0 ); +// returns true + +bool = isNegativeFinite( new Number( -5.0 ) ); +// returns true + +bool = isNegativeFinite( -3.14 ); +// returns true + +bool = isNegativeFinite( 5.0 ); +// returns false + +bool = isNegativeFinite( null ); +// returns false + +bool = isNegativeFinite( Number.NEGATIVE_INFINITY ); +// returns false +``` + +#### isNegativeFinite.isPrimitive( value ) + +Tests if a `value` is a primitive `number` having a finite negative value. + + + +```javascript +var Number = require( '@stdlib/number/ctor' ); + +var bool = isNegativeFinite.isPrimitive( -3.0 ); +// returns true + +bool = isNegativeFinite.isPrimitive( new Number( -3.0 ) ); +// returns false +``` + +#### isNegativeFinite.isObject( value ) + +Tests if a `value` is a `Number` object having a finite negative value. + + + +```javascript +var Number = require( '@stdlib/number/ctor' ); + +var bool = isNegativeFinite.isObject( -3.0 ); +// returns false + +bool = isNegativeFinite.isObject( new Number( -3.0 ) ); +// returns true +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var Number = require( '@stdlib/number/ctor' ); +var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ); + +var bool = isNegativeFinite( -5.0 ); +// returns true + +bool = isNegativeFinite( new Number( -5.0 ) ); +// returns true + +bool = isNegativeFinite( -3.14 ); +// returns true + +bool = isNegativeFinite( 0.0 ); +// returns false + +bool = isNegativeFinite( 5.0 ); +// returns false + +bool = isNegativeFinite( '-5' ); +// returns false + +bool = isNegativeFinite( null ); +// returns false +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/is-negative-finite/benchmark/benchmark.js new file mode 100644 index 00000000000..d598938bf2e --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/benchmark/benchmark.js @@ -0,0 +1,227 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable no-undefined, no-empty-function */ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Number = require( '@stdlib/number/ctor' ); +var pkg = require( './../package.json' ).name; +var isNegativeFinite = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::primitives', function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + '5', + 5.0, + 4.0, + 3.14, + -5.0, + -4.0, + Number.NEGATIVE_INFINITY, + NaN, + true, + false, + null, + undefined + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isNegativeFinite( 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+'::objects', function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + [], + {}, + function noop() {}, + new Number( 2.0 ), + new Number( -3.0 ), + new Number( 3.14 ), + new Number( Number.NEGATIVE_INFINITY ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isNegativeFinite( 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+'::primitives:isPrimitive', function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + '5', + 5.0, + 4.0, + 3.14, + -5.0, + -4.0, + Number.NEGATIVE_INFINITY, + NaN, + true, + false, + null, + undefined + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isNegativeFinite.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+'::objects:isPrimitive', function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + [], + {}, + function noop() {}, + new Number( 2.0 ), + new Number( -3.0 ), + new Number( 3.14 ), + new Number( Number.NEGATIVE_INFINITY ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isNegativeFinite.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+'::primitives:isObject', function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + '5', + 5.0, + 4.0, + 3.14, + -5.0, + -4.0, + Number.NEGATIVE_INFINITY, + NaN, + true, + false, + null, + undefined + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isNegativeFinite.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+'::objects:isObject', function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + [], + {}, + function noop() {}, + new Number( 2.0 ), + new Number( -3.0 ), + new Number( 3.14 ), + new Number( Number.NEGATIVE_INFINITY ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isNegativeFinite.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(); +}); diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-negative-finite/docs/repl.txt new file mode 100644 index 00000000000..3d7241b962c --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/docs/repl.txt @@ -0,0 +1,86 @@ + +{{alias}}( value ) + Tests if a value is a finite negative number. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating whether value is a finite negative number. + + Examples + -------- + > var bool = {{alias}}( -5.0 ) + true + > bool = {{alias}}( new Number( -5.0 ) ) + true + > bool = {{alias}}( -3.14 ) + true + > bool = {{alias}}( 5.0 ) + false + > bool = {{alias}}( null ) + false + > bool = {{alias}}( Number.NEGATIVE_INFINITY ) + false + > bool = {{alias}}( new Number( Number.NEGATIVE_INFINITY ) ) + false + + +{{alias}}.isPrimitive( value ) + Tests if a value is a number primitive having a finite negative value. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating whether value is a number primitive having a finite + negative value. + + Examples + -------- + > var bool = {{alias}}.isPrimitive( -3.0 ) + true + > bool = {{alias}}.isPrimitive( new Number( -3.0 ) ) + false + > var bool = {{alias}}.isPrimitive( Number.NEGATIVE_INFINITY ) + false + > bool = {{alias}}.isPrimitive( new Number( Number.NEGATIVE_INFINITY ) ) + false + + +{{alias}}.isObject( value ) + Tests if a value is a number object having a finite negative value. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating whether value is a number object having a finite + negative value. + + Examples + -------- + > var bool = {{alias}}.isObject( -3.0 ) + false + > bool = {{alias}}.isObject( new Number( -3.0 ) ) + true + > bool = {{alias}}.isObject( Number.NEGATIVE_INFINITY ) + false + > bool = {{alias}}.isObject( new Number( Number.NEGATIVE_INFINITY ) ) + false + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/index.d.ts new file mode 100644 index 00000000000..e0fef0965f6 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/index.d.ts @@ -0,0 +1,137 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Interface defining `isNegativeFinite` with methods for testing for primitives and objects, respectively. +*/ +interface isNegativeFinite { + /** + * Tests if a value is a finite negative number. + * + * @param value - value to test + * @returns boolean indicating whether value is a finite negative number + * + * @example + * var bool = isNegativeFinite( -5.0 ); + * // returns true + * + * @example + * var bool = isNegativeFinite( new Number( -5.0 ) ); + * // returns true + * + * @example + * var bool = isNegativeFinite( -3.14 ); + * // returns true + * + * @example + * var bool = isNegativeFinite( 5.0 ); + * // returns false + * + * @example + * var bool = isNegativeFinite( null ); + * // returns false + * + * @example + * var bool = isNegativeFinite( Number.NEGATIVE_INFINITY ); + * // returns false + */ + ( value: number | Number ): value is number | Number; + + /** + * Tests if a value is a number primitive having a finite negative value. + * + * @param value - value to test + * @returns boolean indicating if a value is a number primitive having a finite negative value + * + * @example + * var bool = isNegativeFinite.isPrimitive( -3.0 ); + * // returns true + * + * @example + * var bool = isNegativeFinite.isPrimitive( new Number( -3.0 ) ); + * // returns false + */ + isPrimitive( value: number | Number ): value is number; + + /** + * Tests if a value is a number object having a negative value. + * + * @param value - value to test + * @returns boolean indicating if a value is a number object having a negative value + * + * @example + * var bool = isNegativeFinite.isObject( -3.0 ); + * // returns false + * + * @example + * var bool = isNegativeFinite.isObject( new Number( -3.0 ) ); + * // returns true + */ + isObject( value: number | Number ): value is Number; +} + +/** +* Tests if a value is a negative number. +* +* @param value - value to test +* @returns boolean indicating whether value is a negative number +* +* @example +* var bool = isNegativeFinite( -5.0 ); +* // returns true +* +* @example +* var bool = isNegativeFinite( new Number( -5.0 ) ); +* // returns true +* +* @example +* var bool = isNegativeFinite( -3.14 ); +* // returns true +* +* @example +* var bool = isNegativeFinite( 5.0 ); +* // returns false +* +* @example +* var bool = isNegativeFinite( null ); +* // returns false +* +* @example +* var bool = isNegativeFinite.isPrimitive( -3.0 ); +* // returns true +* +* @example +* var bool = isNegativeFinite.isObject( new Number( -3.0 ) ); +* // returns true +* +* @example +* var bool = isNegativeFinite.isPrimitive( Number.NEGATIVE_INFINITY ); +* // returns false +* +* @example +* var bool = isNegativeFinite.isObject( new Number( Number.NEGATIVE_INFINITY ) ); +* // returns false +*/ +declare var isNegativeFinite: isNegativeFinite; + + +// EXPORTS // + +export = isNegativeFinite; diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/test.ts new file mode 100644 index 00000000000..26f32d275f9 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/docs/types/test.ts @@ -0,0 +1,60 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import isNegativeFinite = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + isNegativeFinite( 3 ); // $ExpectType boolean + isNegativeFinite( -2 ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isNegativeFinite(); // $ExpectError + isNegativeFinite( -2, 123 ); // $ExpectError +} + +// Attached to main export is an isPrimitive method which returns a boolean... +{ + // eslint-disable-next-line no-new-wrappers + isNegativeFinite.isPrimitive( new Number( -2 ) ); // $ExpectType boolean + isNegativeFinite.isPrimitive( -2 ); // $ExpectType boolean +} + +// The compiler throws an error if the isPrimitive method is provided an unsupported number of arguments... +{ + isNegativeFinite.isPrimitive(); // $ExpectError + isNegativeFinite.isPrimitive( -2, 123 ); // $ExpectError +} + +// Attached to main export is an isObject method which returns a boolean... +{ + // eslint-disable-next-line no-new-wrappers + isNegativeFinite.isObject( new Number( -2 ) ); // $ExpectType boolean + isNegativeFinite.isObject( -2 ); // $ExpectType boolean +} + +// The compiler throws an error if the isObject method is provided an unsupported number of arguments... +{ + isNegativeFinite.isObject(); // $ExpectError + isNegativeFinite.isObject( -2, 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/examples/index.js b/lib/node_modules/@stdlib/assert/is-negative-finite/examples/index.js new file mode 100644 index 00000000000..f9b711182a8 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/examples/index.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Number = require( '@stdlib/number/ctor' ); +var isNegativeFinite = require( './../lib' ); + +console.log( isNegativeFinite( -5.0 ) ); +// => true + +console.log( isNegativeFinite( new Number( -5.0 ) ) ); +// => true + +console.log( isNegativeFinite( -3.14 ) ); +// => true + +console.log( isNegativeFinite( 0.0 ) ); +// => false + +console.log( isNegativeFinite( 5.0 ) ); +// => false + +console.log( isNegativeFinite( '-5' ) ); +// => false + +console.log( isNegativeFinite( null ) ); +// => false + +console.log( isNegativeFinite( Number.NEGATIVE_INFINITY ) ); +// => false + +console.log( isNegativeFinite( new Number(Number.NEGATIVE_INFINITY) ) ); +// => false diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/index.js b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/index.js new file mode 100644 index 00000000000..f2d432df728 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/index.js @@ -0,0 +1,90 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test if a value is a negative finite number. +* +* @module @stdlib/assert/is-negative-finite +* +* @example +* var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ); +* +* var bool = isNegativeFinite( -5.0 ); +* // returns true +* +* bool = isNegativeFinite( new Number( -5.0 ) ); +* // returns true +* +* bool = isNegativeFinite( -3.14 ); +* // returns true +* +* bool = isNegativeFinite( 5.0 ); +* // returns false +* +* bool = isNegativeFinite( null ); +* // returns false +* +* bool = isNegativeFinite( Number.NEGATIVE_INFINITY ); +* // returns false +* +* @example +* // Use interface to check for finite negative number primitives... +* var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ).isPrimitive; +* +* var bool = isNegativeFinite( -3.0 ); +* // returns true +* +* bool = isNegativeFinite( new Number( -3.0 ) ); +* // returns false +* +* bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) ); +* // returns false +* +* @example +* // Use interface to check for negative number objects... +* var isNegativeFinite = require( '@stdlib/assert/is-negative-finite' ).isObject; +* +* var bool = isNegativeFinite( -3.0 ); +* // returns false +* +* bool = isNegativeFinite( new Number( -3.0 ) ); +* // returns true +* +* bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) ); +* // returns false +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var isPrimitive = require( './primitive.js' ); +var isObject = require( './object.js' ); + + +// MAIN // + +setReadOnly( main, 'isPrimitive', isPrimitive ); +setReadOnly( main, 'isObject', isObject ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/main.js b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/main.js new file mode 100644 index 00000000000..d387eed0da0 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/main.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isPrimitive = require( './primitive.js' ); +var isObject = require( './object.js' ); + + +// MAIN // + +/** +* Tests if a value is a finite negative number. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating whether value is a finite negative number +* +* @example +* var bool = isNegativeFinite( -5.0 ); +* // returns true +* +* @example +* var bool = isNegativeFinite( new Number( -5.0 ) ); +* // returns true +* +* @example +* var bool = isNegativeFinite( -3.14 ); +* // returns true +* +* @example +* var bool = isNegativeFinite( 5.0 ); +* // returns false +* +* @example +* var bool = isNegativeFinite( null ); +* // returns false +*/ +function isNegativeFinite( value ) { + return ( isPrimitive( value ) || isObject( value ) ); +} + + +// EXPORTS // + +module.exports = isNegativeFinite; diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js new file mode 100644 index 00000000000..e67c9ca0a15 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/object.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isObject; +var isFinite = require( '@stdlib/assert/is-finite' ).isObject; // eslint-disable-line stdlib/no-redeclare + + +// MAIN // + +/** +* Tests if a value is a number object having a finite negative value. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating if a value is a number object having a finite negative value +* +* @example +* var bool = isNegativeFinite( -3.0 ); +* // returns false +* +* @example +* var bool = isNegativeFinite( Number.NEGATIVE_INFINITY ); +* // returns false +* +* @example +* var bool = isNegativeFinite( new Number( -3.0 ) ); +* // returns true +* +* @example +* var bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) ); +* // returns false +*/ +function isNegativeFinite( value ) { + return ( + isNumber( value ) && + value.valueOf() < 0.0 && isFinite(value) + ); +} + + +// EXPORTS // + +module.exports = isNegativeFinite; diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js new file mode 100644 index 00000000000..94f12997ed3 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/lib/primitive.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isFinite = require( '@stdlib/assert/is-finite' ).isPrimitive; // eslint-disable-line stdlib/no-redeclare + + +// MAIN // + +/** +* Tests if a value is a number primitive having finite a negative value. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating if a value is a number primitive having a finite negative value +* +* @example +* var bool = isNegativeFinite( -3.0 ); +* // returns true +* +* @example +* var bool = isNegativeFinite( Number.NEGATIVE_INFINITY ); +* // returns false +* +* @example +* var bool = isNegativeFinite( new Number( -3.0 ) ); +* // returns false +* +* @example +* var bool = isNegativeFinite( new Number( Number.NEGATIVE_INFINITY ) ); +* // returns false +*/ +function isNegativeFinite( value ) { + return ( + isNumber( value ) && + value < 0.0 && isFinite(value) + ); +} + + +// EXPORTS // + +module.exports = isNegativeFinite; diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/package.json b/lib/node_modules/@stdlib/assert/is-negative-finite/package.json new file mode 100644 index 00000000000..2baaeae6d0a --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/assert/is-negative-number", + "version": "0.0.0", + "description": "Test if a value is a number having a negative value.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdassert", + "assertion", + "assert", + "utilities", + "utility", + "utils", + "util", + "number", + "numeric", + "negative", + "is", + "isnumber", + "isnumeric", + "type", + "check", + "primitive", + "object" + ] +} diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.js b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.js new file mode 100644 index 00000000000..60bfcbf659f --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isNegativeFinite = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isNegativeFinite, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method to test for a primitive number having a finite negative value', function test( t ) { + t.equal( typeof isNegativeFinite.isPrimitive, 'function', 'export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method to test for a number object having a finite negative value', function test( t ) { + t.equal( typeof isNegativeFinite.isObject, 'function', 'export is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.main.js b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.main.js new file mode 100644 index 00000000000..f708c771289 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.main.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Number = require( '@stdlib/number/ctor' ); +var isNegativeFinite = require( './../lib/main.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isNegativeFinite, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a number having a finite negative number value', function test( t ) { + t.equal( isNegativeFinite( -5.0 ), true, 'returns true' ); + t.equal( isNegativeFinite( new Number( -5.0 ) ), true, 'returns true' ); + t.end(); +}); + +tape( 'the function returns `false` if not provided a number having a finite negative number value', function test( t ) { + var values; + var i; + + values = [ + '5', + 3.14, + 1.0, + 0.0, + Number.NEGATIVE_INFINITY, + null, + true, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.equal( isNegativeFinite( values[i] ), false, 'returns false when provided '+values[i] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.object.js b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.object.js new file mode 100644 index 00000000000..bd6743f7c8e --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.object.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Number = require( '@stdlib/number/ctor' ); +var isNegativeFinite = require( './../lib/object.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isNegativeFinite, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a number object having a finite negative value', function test( t ) { + t.equal( isNegativeFinite( new Number( -5.0 ) ), true, 'returns true' ); + t.end(); +}); + +tape( 'the function returns `false` if provided a primitive number, even if the number is a finite negative value', function test( t ) { + t.equal( isNegativeFinite( -3.0 ), false, 'returns false' ); + t.end(); +}); + +tape( 'the function returns `false` if not provided a finite negative number', function test( t ) { + var values; + var i; + + values = [ + '5', + new Number( 0.0 ), + new Number( 2.0 ), + 3.14, + null, + true, + void 0, + Number.NEGATIVE_INFINITY, + [], + {}, + new Date(), + /./, + new RegExp( '.' ), // eslint-disable-line prefer-regex-literals + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.equal( isNegativeFinite( values[i] ), false, 'returns false when provided '+values[i] ); + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.primitive.js b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.primitive.js new file mode 100644 index 00000000000..57a8d300144 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-negative-finite/test/test.primitive.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Number = require( '@stdlib/number/ctor' ); +var isNegativeFinite = require( './../lib/primitive.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isNegativeFinite, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a primitive number having a finite negative value', function test( t ) { + t.equal( isNegativeFinite( -3.0 ), true, 'returns true' ); + t.end(); +}); + +tape( 'the function returns `false` if provided a number object, even if the number has a finite negative value', function test( t ) { + t.equal( isNegativeFinite( new Number( -5.0 ) ), false, 'returns false' ); + t.end(); +}); + +tape( 'the function returns `false` if not provided a finite negative number', function test( t ) { + var values; + var i; + + values = [ + '5', + 0.0, + new Number( 2.0 ), + 3.14, + null, + true, + void 0, + Number.NEGATIVE_INFINITY, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.equal( isNegativeFinite( values[i] ), false, 'returns false when provided '+values[i] ); + } + t.end(); +});