From fb5481c0961b9eb55992c024e88f441a7790a106 Mon Sep 17 00:00:00 2001 From: Abdul Kaium Date: Sat, 18 Jul 2026 17:38:27 +0600 Subject: [PATCH 1/2] feat: add `assert/is-int64` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/assert/is-int64/README.md | 98 +++++++++++++++++++ .../assert/is-int64/benchmark/benchmark.js | 88 +++++++++++++++++ .../assert/is-int64/docs/types/index.d.ts | 44 +++++++++ .../assert/is-int64/docs/types/test.ts | 38 +++++++ .../@stdlib/assert/is-int64/examples/index.js | 35 +++++++ .../@stdlib/assert/is-int64/lib/index.js | 43 ++++++++ .../@stdlib/assert/is-int64/lib/main.js | 53 ++++++++++ .../@stdlib/assert/is-int64/package.json | 73 ++++++++++++++ .../@stdlib/assert/is-int64/test/test.js | 63 ++++++++++++ 9 files changed, 535 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-int64/README.md create mode 100644 lib/node_modules/@stdlib/assert/is-int64/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/assert/is-int64/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/is-int64/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/assert/is-int64/examples/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-int64/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/is-int64/lib/main.js create mode 100644 lib/node_modules/@stdlib/assert/is-int64/package.json create mode 100644 lib/node_modules/@stdlib/assert/is-int64/test/test.js diff --git a/lib/node_modules/@stdlib/assert/is-int64/README.md b/lib/node_modules/@stdlib/assert/is-int64/README.md new file mode 100644 index 000000000000..6323d166a952 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/README.md @@ -0,0 +1,98 @@ + + +# isInt64 + +> Test if a value is a [64-bit signed integer][@stdlib/number/int64/ctor]. + +
+ +## Usage + +```javascript +var isInt64 = require( '@stdlib/assert/is-int64' ); +``` + +#### isInt64( value ) + +Tests if a value is a [64-bit signed integer][@stdlib/number/int64/ctor]. + +```javascript +var Int64 = require( '@stdlib/number/int64/ctor' ); + +var x = new Int64( 1234 ); + +var bool = isInt64( x ); +// returns true +``` + +
+ + + +
+ +## Examples + + + +```javascript +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Int64 = require( '@stdlib/number/int64/ctor' ); +var isInt64 = require( '@stdlib/assert/is-int64' ); + +console.log( isInt64( new Int64( 1234 ) ) ); +// => true + +console.log( isInt64( new Complex128( 3.0, 1.0 ) ) ); +// => false + +console.log( isInt64( {} ) ); +// => false + +console.log( isInt64( null ) ); +// => false +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/is-int64/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/is-int64/benchmark/benchmark.js new file mode 100644 index 000000000000..d3543088f3ee --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/benchmark/benchmark.js @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var Int64 = require( '@stdlib/number/int64/ctor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var isInt64 = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::true', pkg ), function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + new Int64( 1234 ), + new Int64( 5678 ), + new Int64( 9012 ), + new Int64( 3456 ) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isInt64( 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( format( '%s::false', pkg ), function benchmark( b ) { + var values; + var bool; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + [], + {} + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = isInt64( 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-int64/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/is-int64/docs/types/index.d.ts new file mode 100644 index 000000000000..3c6b5cf63223 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/docs/types/index.d.ts @@ -0,0 +1,44 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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 + +/// + +import { Int64 } from '@stdlib/types/number'; + +/** +* Tests if a value is a 64-bit signed integer. +* +* @param value - value to test +* @returns boolean indicating if a value is a 64-bit signed integer +* +* @example +* var Int64 = require( '@stdlib/number/int64/ctor' ); +* +* var x = new Int64( 1234 ); +* +* var bool = isInt64( x ); +* // returns true +*/ +declare function isInt64( value: any ): value is Int64; + + +// EXPORTS // + +export = isInt64; diff --git a/lib/node_modules/@stdlib/assert/is-int64/docs/types/test.ts b/lib/node_modules/@stdlib/assert/is-int64/docs/types/test.ts new file mode 100644 index 000000000000..bdd4c366a136 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/docs/types/test.ts @@ -0,0 +1,38 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +import Int64 = require( '@stdlib/number/int64/ctor' ); +import isInt64 = require( '@stdlib/assert/is-int64' ); + + +// TESTS // + +// The function returns a boolean... +{ + isInt64( new Int64( 1234 ) ); // $ExpectType boolean + isInt64( new Complex128( 5.0, 3.0 ) ); // $ExpectType boolean + isInt64( {} ); // $ExpectType boolean + isInt64( 123 ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + isInt64(); // $ExpectError + isInt64( new Int64( 1234 ), 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/assert/is-int64/examples/index.js b/lib/node_modules/@stdlib/assert/is-int64/examples/index.js new file mode 100644 index 000000000000..10eec6df104d --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Int64 = require( '@stdlib/number/int64/ctor' ); +var isInt64 = require( './../lib' ); + +console.log( isInt64( new Int64( 1234 ) ) ); +// => true + +console.log( isInt64( new Complex128( 3.0, 1.0 ) ) ); +// => false + +console.log( isInt64( {} ) ); +// => false + +console.log( isInt64( null ) ); +// => false diff --git a/lib/node_modules/@stdlib/assert/is-int64/lib/index.js b/lib/node_modules/@stdlib/assert/is-int64/lib/index.js new file mode 100644 index 000000000000..efd42bd9c81c --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 64-bit signed integer. +* +* @module @stdlib/assert/is-int64 +* +* @example +* var Int64 = require( '@stdlib/number/int64/ctor' ); +* var isInt64 = require( '@stdlib/assert/is-int64' ); +* +* var x = new Int64( 1234 ); +* +* var bool = isInt64( x ); +* // returns true +*/ + +// MODULES // + +var isInt64 = require( './main.js' ); + + +// EXPORTS // + +module.exports = isInt64; diff --git a/lib/node_modules/@stdlib/assert/is-int64/lib/main.js b/lib/node_modules/@stdlib/assert/is-int64/lib/main.js new file mode 100644 index 000000000000..665d6b60e36e --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/lib/main.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 Int64 = require( '@stdlib/number/int64/ctor' ); +var constructorName = require( '@stdlib/utils/constructor-name' ); + + +// MAIN // + +/** +* Tests if a value is a 64-bit signed integer. +* +* @param {*} value - value to test +* @returns {boolean} boolean indicating if a value is a 64-bit signed integer +* +* @example +* var Int64 = require( '@stdlib/number/int64/ctor' ); +* +* var x = new Int64( 1234 ); +* +* var bool = isInt64( x ); +* // returns true +*/ +function isInt64( value ) { + return ( + value instanceof Int64 || + constructorName( value ) === 'Int64' + ); +} + + +// EXPORTS // + +module.exports = isInt64; diff --git a/lib/node_modules/@stdlib/assert/is-int64/package.json b/lib/node_modules/@stdlib/assert/is-int64/package.json new file mode 100644 index 000000000000..d45b6238185f --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/assert/is-int64", + "version": "0.0.0", + "description": "Test if a value is a 64-bit signed integer.", + "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", + "is", + "isint64", + "int64", + "signed", + "64-bit", + "integer", + "type", + "check", + "test", + "validate", + "isvalid", + "valid" + ] +} diff --git a/lib/node_modules/@stdlib/assert/is-int64/test/test.js b/lib/node_modules/@stdlib/assert/is-int64/test/test.js new file mode 100644 index 000000000000..6c30cde8d72a --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/test/test.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 Int64 = require( '@stdlib/number/int64/ctor' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var isInt64 = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof isInt64, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `true` if provided a 64-bit signed integer', function test( t ) { + t.strictEqual( isInt64( new Int64( 1234 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `false` if not provided a 64-bit signed integer', function test( t ) { + var values; + var i; + + values = [ + 5, + '5', + null, + void 0, + NaN, + true, + [], + {}, + new Complex128( 2.0, 2.0 ), + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.strictEqual( isInt64( values[i] ), false, 'returns false when provided '+values[i] ); + } + t.end(); +}); From c0b0a71bf17b29eeaefc991f809cabd584f4619d Mon Sep 17 00:00:00 2001 From: Abdul Kaium Date: Sat, 18 Jul 2026 18:40:39 +0600 Subject: [PATCH 2/2] docs: add repl text --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/assert/is-int64/docs/repl.txt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/is-int64/docs/repl.txt diff --git a/lib/node_modules/@stdlib/assert/is-int64/docs/repl.txt b/lib/node_modules/@stdlib/assert/is-int64/docs/repl.txt new file mode 100644 index 000000000000..5018ced0e666 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/is-int64/docs/repl.txt @@ -0,0 +1,28 @@ + +{{alias}}( value ) + Tests if a value is a 64-bit signed integer. + + Parameters + ---------- + value: any + Value to test. + + Returns + ------- + bool: boolean + Boolean indicating whether a value is a 64-bit signed integer. + + Examples + -------- + > var bool = {{alias}}( new {{alias:@stdlib/number/int64/ctor}}( 1234 ) ) + true + > bool = {{alias}}( new {{alias:@stdlib/complex/float64/ctor}}( 3.0, 1.0 ) ) + false + > bool = {{alias}}( 3.14 ) + false + > bool = {{alias}}( {} ) + false + + See Also + -------- +