Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
98 changes: 98 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!--

@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.

-->

# isUint64

> Test if a value is an [unsigned 64-bit integer][@stdlib/number/uint64/ctor].

<section class="usage">

## Usage

```javascript
var isUint64 = require( '@stdlib/assert/is-uint64' );
```

#### isUint64( value )

Tests if a value is an [unsigned 64-bit integer][@stdlib/number/uint64/ctor].

```javascript
var Uint64 = require( '@stdlib/number/uint64/ctor' );

var x = new Uint64( 1234 );

var bool = isUint64( x );
// returns true
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Uint64 = require( '@stdlib/number/uint64/ctor' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var isUint64 = require( '@stdlib/assert/is-uint64' );

console.log( isUint64( new Uint64( 1234 ) ) );
// => true

console.log( isUint64( new Complex128( 3.0, 1.0 ) ) );
// => false

console.log( isUint64( {} ) );
// => false

console.log( isUint64( null ) );
// => false
```

</section>

<!-- /.examples -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[@stdlib/number/uint64/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/number/uint64/ctor

<!-- <related-links> -->

<!-- </related-links> -->

</section>

<!-- /.links -->
88 changes: 88 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -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 Uint64 = require( '@stdlib/number/uint64/ctor' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var isUint64 = require( './../lib' );


// MAIN //

bench( format( '%s::true', pkg ), function benchmark( b ) {
var values;
var bool;
var i;

values = [
new Uint64( 1234 ),
new Uint64( 5678 ),
new Uint64( 9012 ),
new Uint64( 3456 )
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
bool = isUint64( 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 = isUint64( 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();
});
28 changes: 28 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

{{alias}}( value )
Tests if a value is an unsigned 64-bit integer.

Parameters
----------
value: any
Value to test.

Returns
-------
bool: boolean
Boolean indicating whether a value is an unsigned 64-bit integer.

Examples
--------
> var bool = {{alias}}( new {{alias:@stdlib/number/uint64/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
--------

44 changes: 44 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -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

/// <reference types="@stdlib/types"/>

import { Uint64 } from '@stdlib/types/number';

/**
* Tests if a value is an unsigned 64-bit integer.
*
* @param value - value to test
* @returns boolean indicating if a value is an unsigned 64-bit integer
*
* @example
* var Uint64 = require( '@stdlib/number/uint64/ctor' );
*
* var x = new Uint64( 1234 );
*
* var bool = isUint64( x );
* // returns true
*/
declare function isUint64( value: any ): value is Uint64;

Check warning on line 39 in lib/node_modules/@stdlib/assert/is-uint64/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type


// EXPORTS //

export = isUint64;
38 changes: 38 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -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 Uint64 = require( '@stdlib/number/uint64/ctor' );
import isUint64 = require( './index' );


// TESTS //

// The function returns a boolean...
{
isUint64( new Uint64( 1234 ) ); // $ExpectType boolean
isUint64( new Complex128( 5.0, 3.0 ) ); // $ExpectType boolean
isUint64( {} ); // $ExpectType boolean
isUint64( 123 ); // $ExpectType boolean
}

// The compiler throws an error if the function is provided an unsupported number of arguments...
{
isUint64(); // $ExpectError
isUint64( new Uint64( 1234 ), 123 ); // $ExpectError
}
35 changes: 35 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/examples/index.js
Original file line number Diff line number Diff line change
@@ -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 Uint64 = require( '@stdlib/number/uint64/ctor' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var isUint64 = require( './../lib' );

console.log( isUint64( new Uint64( 1234 ) ) );
// => true

console.log( isUint64( new Complex128( 3.0, 1.0 ) ) );
// => false

console.log( isUint64( {} ) );
// => false

console.log( isUint64( null ) );
// => false
43 changes: 43 additions & 0 deletions lib/node_modules/@stdlib/assert/is-uint64/lib/index.js
Original file line number Diff line number Diff line change
@@ -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 an unsigned 64-bit integer.
*
* @module @stdlib/assert/is-uint64
*
* @example
* var Uint64 = require( '@stdlib/number/uint64/ctor' );
* var isUint64 = require( '@stdlib/assert/is-uint64' );
*
* var x = new Uint64( 1234 );
*
* var bool = isUint64( x );
* // returns true
*/

// MODULES //

var isUint64 = require( './main.js' );


// EXPORTS //

module.exports = isUint64;
Loading