Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b6e7972
chore: clean up get method benchmark
DivitJain26 Aug 5, 2026
dc46aca
feat: add method copywithin
DivitJain26 Aug 5, 2026
f7af12e
test: add test for copywithin
DivitJain26 Aug 10, 2026
8b86e23
bench: add benchmark for copywithin
DivitJain26 Aug 10, 2026
99d6449
docs: add type definition for copywithin
DivitJain26 Aug 10, 2026
707235f
docs: add repl text for copywithin
DivitJain26 Aug 10, 2026
6f6be3b
docs: add readme for copywithin
DivitJain26 Aug 10, 2026
07045e0
fix: fix repl file lint error
DivitJain26 Aug 11, 2026
ff6f588
chore: update exmaples
DivitJain26 Aug 14, 2026
59a7ce6
bench: improve benchmarks
DivitJain26 Sep 24, 2026
1307908
chore: clean up unsed imports
DivitJain26 Oct 28, 2026
b0d702e
test: use iEqualUint64Array
DivitJain26 Oct 28, 2026
e7488bc
docs: improve definition and doc test examples
DivitJain26 Oct 29, 2026
694f904
Merge branch 'develop' into feat/add-uint64array-copywithin
DivitJain26 Oct 29, 2026
fb02569
feat: add implementation for every
DivitJain26 Aug 10, 2026
d9f3d71
test: add tests for every
DivitJain26 Aug 11, 2026
c9e1566
bench: add benchmarks for every method
DivitJain26 Aug 11, 2026
89244bc
docs: add type definition for every method
DivitJain26 Aug 11, 2026
c6383bc
docs: add repl text for every method
DivitJain26 Aug 11, 2026
e4269cc
docs: add readme for every method
DivitJain26 Aug 11, 2026
a9bc82c
refactor: use isPrimitive
DivitJain26 Aug 13, 2026
7bdbde7
chore: update exmaples
DivitJain26 Aug 14, 2026
fb5689f
bench: improve benchmarks
DivitJain26 Sep 24, 2026
a5cd512
chore: clean up
DivitJain26 Oct 28, 2026
68da5b0
chore: add every in fill
DivitJain26 Oct 23, 2026
8a34919
chore: add uint64 convertion check
DivitJain26 Aug 11, 2026
5d20485
chore: checkpoint
DivitJain26 Aug 12, 2026
e0f1d52
chore: update exmaples
DivitJain26 Aug 14, 2026
740dba0
bench: add benchmarks
DivitJain26 Aug 14, 2026
298d721
docs: adds type definition
DivitJain26 Aug 14, 2026
cea69cf
docs: adds repl text
DivitJain26 Aug 14, 2026
b20a286
docs: adds readme
DivitJain26 Aug 14, 2026
e0519e3
chore: clean up
DivitJain26 Oct 29, 2026
ab32239
feat: adds implementation for filter method
DivitJain26 Aug 14, 2026
4ddc7fe
docs: add tupe definition
DivitJain26 Aug 14, 2026
c9c8d8d
docs: add repl text
DivitJain26 Aug 14, 2026
cbf0706
bench: add benchmarks
DivitJain26 Aug 14, 2026
4fe0ce5
docs: add readme
DivitJain26 Aug 14, 2026
b30d7a5
bench: update benchmarks
DivitJain26 Sep 9, 2026
c52a16c
fix: add isPrimitive
DivitJain26 Sep 9, 2026
28242af
bench: improve benchmarks
DivitJain26 Sep 24, 2026
20ba966
chore: clean up
DivitJain26 Oct 29, 2026
126bc7b
docs: add readme
DivitJain26 Aug 14, 2026
7430b67
feat: add implementation for find
DivitJain26 Aug 14, 2026
08b2905
test: adds test for find
DivitJain26 Aug 14, 2026
a8f4f7f
test: adds type definition
DivitJain26 Aug 14, 2026
b84d17d
test: adds repl text
DivitJain26 Aug 14, 2026
3406982
test: add benchmarks
DivitJain26 Aug 14, 2026
59ce548
docs: add readme
DivitJain26 Aug 14, 2026
ffec0ff
bench: update benchmarks
DivitJain26 Sep 9, 2026
e93297c
fix: add isPrimitive
DivitJain26 Sep 9, 2026
dab75af
bench: improve benchmarks
DivitJain26 Sep 24, 2026
e9fa5d3
chore: clean up
DivitJain26 Nov 5, 2026
0b1966a
docs: add readme
DivitJain26 Aug 14, 2026
19c9f8a
feat: adds implementation for findIndex
DivitJain26 Aug 15, 2026
a4df434
test: adds test for findIndex
DivitJain26 Aug 15, 2026
8645c71
docs: adds type definition for findIndex
DivitJain26 Aug 15, 2026
1803ead
docs: adds repl text for findIndex
DivitJain26 Aug 15, 2026
c54ebf3
bench: add benchmarks for findIndex
DivitJain26 Aug 15, 2026
9be5117
docs: adds readme for findIndex
DivitJain26 Aug 15, 2026
5c5b2d8
fix: update copy right years
DivitJain26 Aug 15, 2026
4757b7a
bench: update benchmarks
DivitJain26 Sep 9, 2026
af0a0ff
fix: add isPrimitive
DivitJain26 Sep 9, 2026
78f06d6
bench: improve benchmarks
DivitJain26 Sep 24, 2026
f8c93e5
chore: clean up
DivitJain26 Nov 5, 2026
f647ea2
feat: add implementation for findlast
DivitJain26 Sep 7, 2026
4998423
test: add test for findlast
DivitJain26 Sep 7, 2026
4ea735e
test: add test for findlast
DivitJain26 Sep 7, 2026
802194e
docs: add docs for findlast
DivitJain26 Sep 7, 2026
c6803b1
bench: add benchmakrs for findlast
DivitJain26 Sep 7, 2026
bccc300
docs: add readme for findlast
DivitJain26 Sep 7, 2026
39b5514
bench: update benchmarks
DivitJain26 Sep 9, 2026
71f184a
bench: improve benchmarks
DivitJain26 Sep 24, 2026
8711683
chore: clean up
DivitJain26 Nov 5, 2026
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
326 changes: 326 additions & 0 deletions lib/node_modules/@stdlib/array/uint64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,40 @@ u = arr.at( -100 );
// returns undefined
```

<a name="method-copy-within"></a>

#### Uint64Array.prototype.copyWithin( target, start\[, end] )

Copies a sequence of elements within the array starting at `start` and ending at `end` (non-inclusive) to the position starting at `target`.

```javascript
var arr = new Uint64Array( [ 1, 2, 3, 4 ] );

// Copy the last two elements to the first two elements:
arr.copyWithin( 0, 2 );
// arr => <Uint64Array>[ 3n, 4n, 3n, 4n ]
```

By default, `end` equals the number of array elements (i.e., one more than the last array index). To limit the sequence length, provide an `end` argument.

```javascript
var arr = new Uint64Array( [ 1, 2, 3, 4 ] );

// Copy the first two elements to the last two elements:
arr.copyWithin( 2, 0, 2 );
// arr => <Uint64Array>[ 1n, 2n, 1n, 2n ]
```

When a `target`, `start`, and/or `end` index is negative, the respective index is determined relative to the last array element. The following example achieves the same behavior as the previous example:

```javascript
var arr = new Uint64Array( [ 1, 2, 3, 4 ] );

// Copy the first two elements to the last two elements using negative indices:
arr.copyWithin( -2, -4, -2 );
// arr => <Uint64Array>[ 1n, 2n, 1n, 2n ]
```

<a name="method-entries"></a>

#### Uint64Array.prototype.entries()
Expand Down Expand Up @@ -309,6 +343,298 @@ The returned [iterator][mdn-iterator-protocol] protocol-compliant object has the
- **next**: function which returns an [iterator][mdn-iterator-protocol] protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the [iterator][mdn-iterator-protocol] is finished.
- **return**: function which closes an [iterator][mdn-iterator-protocol] and returns a single (optional) argument in an [iterator][mdn-iterator-protocol] protocol-compliant object.

<a name="method-every"></a>

#### Uint64Array.prototype.every( predicate\[, thisArg] )

Returns a boolean indicating whether all elements pass a test.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v ) {
return ( isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 2, 4, 6 ] );

// Check whether all elements pass a test:
var bool = arr.every( predicate );
// returns true
```

The `predicate` function is provided three arguments:

- **value**: current array element.
- **index**: current array element index.
- **arr**: the array on which this method was called.

To set the function execution context, provide a `thisArg`.

```javascript
function predicate( v, i ) {
this.count += 1;
return ( i >= 0 );
}

var arr = new Uint64Array( [ 2, 4, 6 ] );

var context = {
'count': 0
};

var bool = arr.every( predicate, context );
// returns true

var count = context.count;
// returns 3
```

<a name="method-fill"></a>

#### Uint64Array.prototype.fill( value\[, start\[, end]] )

Fills an array from a `start` index to an `end` index (non-inclusive) with a provided `value`.

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

var arr = new Uint64Array( 3 );

// Set all elements to the same value:
arr.fill( new Uint64( 1 ) );
// arr => <Uint64Array>[ 1n, 1n, 1n ]

// Fill all elements starting from the second element:
arr.fill( new Uint64( 2 ), 1 );
// arr => <Uint64Array>[ 1n, 2n, 2n ]

// Fill all elements from first element until the second-to-last element:
arr.fill( new Uint64( 3 ), 0, 2 );
// arr => <Uint64Array>[ 3n, 3n, 2n ]
```

When a `start` and/or `end` index is negative, the respective index is determined relative to the last array element.

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

var arr = new Uint64Array( 3 );

// Set all array elements, except the last element, to the same value:
arr.fill( new Uint64( 1 ), 0, -1 );
// arr => <Uint64Array>[ 1n, 1n, 0n ]
```

<a name="method-filter"></a>

#### Uint64Array.prototype.filter( predicate\[, thisArg] )

Returns a new array containing the elements of an array which pass a test implemented by a predicate function.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v ) {
return ( isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 2, 3, 4, 5, 6 ] );

var out = arr.filter( predicate );
// returns <Uint64Array>[ 2n, 4n, 6n ]

var len = out.length;
// returns 3
```

The `predicate` function is provided three arguments:

- **value**: current array element.
- **index**: current array element index.
- **arr**: the array on which this method was called.

To set the function execution context, provide a `thisArg`.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v, i ) {
this.count += 1;
return ( i >= 0 && isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 2, 3, 4, 5, 6 ] );

var context = {
'count': 0
};

var out = arr.filter( predicate, context );
// returns <Uint64Array>[ 2n, 4n, 6n ]

var len = out.length;
// returns 3

var count = context.count;
// returns 6
```

<a name="method-find"></a>

#### Uint64Array.prototype.find( predicate\[, thisArg] )

Returns the first element in an array for which a predicate function returns a truthy value.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v ) {
return ( isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 3, 4, 5 ] );

var u = arr.find( predicate );
// returns <Uint64>[ 4n ]
```

The `predicate` function is provided three arguments:

- **value**: current array element.
- **index**: current array element index.
- **arr**: the array on which this method was called.

To set the function execution context, provide a `thisArg`.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v, i ) {
this.count += 1;
return ( i >= 0 && isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 3, 4, 5 ] );

var context = {
'count': 0
};

var u = arr.find( predicate, context );
// returns <Uint64>[ 4n ]

var count = context.count;
// returns 3
```

<a name="method-find-index"></a>

#### Uint64Array.prototype.findIndex( predicate\[, thisArg] )

Returns the index of the first element in an array for which a predicate function returns a truthy value.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v ) {
return ( isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 3, 4, 6 ] );

var idx = arr.findIndex( predicate );
// returns 2
```

The `predicate` function is provided three arguments:

- **value**: current array element.
- **index**: current array element index.
- **arr**: the array on which this method was called.

To set the function execution context, provide a `thisArg`.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v, i ) {
this.count += 1;
return ( i >= 0 && isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 3, 5, 7 ] );

var context = {
'count': 0
};

var idx = arr.findIndex( predicate, context );
// returns -1

var count = context.count;
// returns 4
```

<a name="method-find-last"></a>

#### Uint64Array.prototype.findLast( predicate\[, thisArg] )

Returns the last element in an array for which a `predicate` function returns a truthy value.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v ) {
return ( isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 2, 3, 4, 5 ] );

var u = arr.findLast( predicate );
// returns <Uint64>[ 4n ]
```

The `predicate` function is provided three arguments:

- **value**: current array element.
- **index**: current array element index.
- **arr**: the array on which this method was called.

To set the function execution context, provide a `thisArg`.

```javascript
var isEven = require( '@stdlib/assert/is-even' ).isPrimitive;
var Number = require( '@stdlib/number/ctor' );

function predicate( v ) {
this.count += 1;
return ( isEven( Number( v ) ) );
}

var arr = new Uint64Array( [ 1, 2, 3, 4, 5 ] );

var context = {
'count': 0
};

var u = arr.findLast( predicate, context );
// returns <Uint64>[ 4n ]

var count = context.count;
// returns 2
```

If a `predicate` function never returns a truthy value, the method returns `undefined`.

<a name="method-get"></a>

#### Uint64Array.prototype.get( i )
Expand Down
Original file line number Diff line number Diff line change
@@ -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 bench = require( '@stdlib/bench' );
var isUint64Array = require( '@stdlib/assert/is-uint64array' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var Uint64Array = require( './../lib' );


// MAIN //

bench( format( '%s:copyWithin', pkg ), function benchmark( b ) {
var arr;
var out;
var i;

arr = new Uint64Array( 10 );

// Benchmark worst case scenario (i.e., copying all but one element to an overlapping region)...
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = arr.copyWithin( 1, 0 );
if ( typeof out !== 'object' ) {
b.fail( 'should return an object' );
}
}
b.toc();
if ( !isUint64Array( out ) ) {
b.fail( 'should return a Uint64Array' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading
Loading