Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29a04c0

Browse files
committed
Auto-generated commit
1 parent7e0795d commit29a04c0

File tree

18 files changed

+2325
-179
lines changed

18 files changed

+2325
-179
lines changed

‎CHANGELOG.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
55
<sectionclass="release"id="unreleased">
66

7-
##Unreleased (2024-06-05)
7+
##Unreleased (2024-06-18)
88

99
<sectionclass="features">
1010

1111
###Features
1212

13+
-[`b079d65`](https://github.com/stdlib-js/stdlib/commit/b079d653226019925581555fdaf9aa927ec69c0e) - add support for integer array indexing assignment
1314
-[`96e896a`](https://github.com/stdlib-js/stdlib/commit/96e896a39be08912b2e06dfb6b671ec13d042412) - add support for boolean array indices
1415

1516
</section>
@@ -22,6 +23,7 @@
2223

2324
<details>
2425

26+
-[`b079d65`](https://github.com/stdlib-js/stdlib/commit/b079d653226019925581555fdaf9aa927ec69c0e) -**feat:** add support for integer array indexing assignment_(by Athan Reines)_
2527
-[`96e896a`](https://github.com/stdlib-js/stdlib/commit/96e896a39be08912b2e06dfb6b671ec13d042412) -**feat:** add support for boolean array indices_(by Athan Reines)_
2628
-[`75d4f83`](https://github.com/stdlib-js/stdlib/commit/75d4f83cb85610d23a04dc21a03f8075f6d3665f) -**refactor:** update require and include paths_(by Athan Reines)_
2729

‎CONTRIBUTORS‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
6363
Raunak Kumar Gupta <raunakmodanwal321@gmail.com>
6464
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
6565
Ricky Reusser <rsreusser@gmail.com>
66+
Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
6667
Robert Gislason <gztown2216@yahoo.com>
6768
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
6869
Rutam <138517416+performant23@users.noreply.github.com>
@@ -75,7 +76,7 @@ Shraddheya Shendre <shendreshraddheya@gmail.com>
7576
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
7677
Shubham Mishra <shubh622005@gmail.com>
7778
Sivam Das <100067002+Sivam2313@users.noreply.github.com>
78-
Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com>
79+
Snehil Shah <snehilshah.989@gmail.com>
7980
Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com>
8081
Spandan Barve <contact@marsian.dev>
8182
Stephannie Jiménez Gacha <steff456@hotmail.com>

‎README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ im = imag( v );
489489
```javascript
490490
varUint8Array=require('@stdlib/array-uint8' );
491491
varInt32Array=require('@stdlib/array-int32' );
492+
var BooleanArray=require('@stdlib/array-bool' );
492493
var array2fancy=require('@stdlib/array-to-fancy' );
493494

494495
var x= [1,2,3,4,5,6 ];
@@ -525,6 +526,10 @@ i = idx( [ true, false, false, true, true, true ] ); // boolean array
525526
z= y[ i ];
526527
// returns [ 1, -9, -8, 6 ]
527528

529+
i=idx(newBooleanArray( [true,false,false,true,true,true ] ) );// boolean array
530+
z= y[ i ];
531+
// returns [ 1, -9, -8, 6 ]
532+
528533
i=idx(newUint8Array( [0,0,1,0,0,1 ] ) );// mask array
529534
z= y[ i ];
530535
// returns [ 1, 2, -9, -8 ]

‎benchmark/benchmark.set.js‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,41 @@ bench( pkg+'::set,subsequence:len=1', opts, function benchmark( b ) {
155155
b.pass('benchmark finished');
156156
b.end();
157157
});
158+
159+
bench(pkg+'::set,integer_array:len=1',opts,functionbenchmark(b){
160+
varvalues;
161+
varbase;
162+
varopts;
163+
varidx;
164+
varx;
165+
varv;
166+
vari;
167+
168+
base=zeroTo(100,'generic');
169+
x=array2fancy(base);
170+
171+
opts={
172+
'persist':true
173+
};
174+
values=[
175+
array2fancy.idx([0],opts),
176+
array2fancy.idx([1],opts),
177+
array2fancy.idx([2],opts)
178+
];
179+
180+
b.tic();
181+
for(i=0;i<b.iterations;i++){
182+
idx=values[i%values.length];
183+
x[idx]=i*2;
184+
v=base[i%3];
185+
if(v!==v){
186+
b.fail('should not return NaN');
187+
}
188+
}
189+
b.toc();
190+
if(isnan(v)){
191+
b.fail('should not return NaN');
192+
}
193+
b.pass('benchmark finished');
194+
b.end();
195+
});

‎dist/index.js‎

Lines changed: 57 additions & 55 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎dist/index.js.map‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/types/index.d.ts‎

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

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

23-
import{Collection,ArrayLike,AccessorArrayLike,Complex128Array,Complex64Array,ArrayIndexObject}from'@stdlib/types/array';
23+
import{Collection,ArrayLike,AccessorArrayLike,ComplexTypedArray,TypedArray,BooleanTypedArray,ArrayIndexObject}from'@stdlib/types/array';
2424
importArrayIndex= require('@stdlib/array-index');
2525

2626
/**
@@ -74,17 +74,6 @@ interface Array2Fancy {
7474
*
7575
* var v = y[ ':' ];
7676
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0 ]
77-
*/
78-
(x:Float64Array,options?:Options):Float64Array;
79-
80-
/**
81-
* Converts an array to an object supporting fancy indexing.
82-
*
83-
*@param x - input array
84-
*@param options - function options
85-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
86-
*@param options.cache - cache for resolving array index objects
87-
*@returns fancy array
8877
*
8978
*@example
9079
* var Float32Array = require( '@stdlib/array-float32' );
@@ -96,17 +85,6 @@ interface Array2Fancy {
9685
*
9786
* var v = y[ ':' ];
9887
* // returns <Float32Array>[ 1.0, 2.0, 3.0, 4.0 ]
99-
*/
100-
(x:Float32Array,options?:Options):Float32Array;
101-
102-
/**
103-
* Converts an array to an object supporting fancy indexing.
104-
*
105-
*@param x - input array
106-
*@param options - function options
107-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
108-
*@param options.cache - cache for resolving array index objects
109-
*@returns fancy array
11088
*
11189
*@example
11290
* var Complex128Array = require( '@stdlib/array-complex128' );
@@ -118,17 +96,6 @@ interface Array2Fancy {
11896
*
11997
* var v = y[ ':' ];
12098
* // returns <Complex128Array>[ 1.0, 2.0, 3.0, 4.0 ]
121-
*/
122-
(x:Complex128Array,options?:Options):Complex128Array;
123-
124-
/**
125-
* Converts an array to an object supporting fancy indexing.
126-
*
127-
*@param x - input array
128-
*@param options - function options
129-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
130-
*@param options.cache - cache for resolving array index objects
131-
*@returns fancy array
13299
*
133100
*@example
134101
* var Complex64Array = require( '@stdlib/array-complex64' );
@@ -140,17 +107,6 @@ interface Array2Fancy {
140107
*
141108
* var v = y[ ':' ];
142109
* // returns <Complex64Array>[ 1.0, 2.0, 3.0, 4.0 ]
143-
*/
144-
(x:Complex64Array,options?:Options):Complex64Array;
145-
146-
/**
147-
* Converts an array to an object supporting fancy indexing.
148-
*
149-
*@param x - input array
150-
*@param options - function options
151-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
152-
*@param options.cache - cache for resolving array index objects
153-
*@returns fancy array
154110
*
155111
*@example
156112
* var Int32Array = require( '@stdlib/array-int32' );
@@ -162,17 +118,6 @@ interface Array2Fancy {
162118
*
163119
* var v = y[ ':' ];
164120
* // returns <Int32Array>[ 1, 2, 3, 4 ]
165-
*/
166-
(x:Int32Array,options?:Options):Int32Array;
167-
168-
/**
169-
* Converts an array to an object supporting fancy indexing.
170-
*
171-
*@param x - input array
172-
*@param options - function options
173-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
174-
*@param options.cache - cache for resolving array index objects
175-
*@returns fancy array
176121
*
177122
*@example
178123
* var Int16Array = require( '@stdlib/array-int16' );
@@ -184,17 +129,6 @@ interface Array2Fancy {
184129
*
185130
* var v = y[ ':' ];
186131
* // returns <Int16Array>[ 1, 2, 3, 4 ]
187-
*/
188-
(x:Int16Array,options?:Options):Int16Array;
189-
190-
/**
191-
* Converts an array to an object supporting fancy indexing.
192-
*
193-
*@param x - input array
194-
*@param options - function options
195-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
196-
*@param options.cache - cache for resolving array index objects
197-
*@returns fancy array
198132
*
199133
*@example
200134
* var Int8Array = require( '@stdlib/array-int8' );
@@ -206,17 +140,6 @@ interface Array2Fancy {
206140
*
207141
* var v = y[ ':' ];
208142
* // returns <Int8Array>[ 1, 2, 3, 4 ]
209-
*/
210-
(x:Int8Array,options?:Options):Int8Array;
211-
212-
/**
213-
* Converts an array to an object supporting fancy indexing.
214-
*
215-
*@param x - input array
216-
*@param options - function options
217-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
218-
*@param options.cache - cache for resolving array index objects
219-
*@returns fancy array
220143
*
221144
*@example
222145
* var Uint32Array = require( '@stdlib/array-uint32' );
@@ -228,17 +151,6 @@ interface Array2Fancy {
228151
*
229152
* var v = y[ ':' ];
230153
* // returns <Uint32Array>[ 1, 2, 3, 4 ]
231-
*/
232-
(x:Uint32Array,options?:Options):Uint32Array;
233-
234-
/**
235-
* Converts an array to an object supporting fancy indexing.
236-
*
237-
*@param x - input array
238-
*@param options - function options
239-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
240-
*@param options.cache - cache for resolving array index objects
241-
*@returns fancy array
242154
*
243155
*@example
244156
* var Uint16Array = require( '@stdlib/array-uint16' );
@@ -250,17 +162,6 @@ interface Array2Fancy {
250162
*
251163
* var v = y[ ':' ];
252164
* // returns <Uint16Array>[ 1, 2, 3, 4 ]
253-
*/
254-
(x:Uint16Array,options?:Options):Uint16Array;
255-
256-
/**
257-
* Converts an array to an object supporting fancy indexing.
258-
*
259-
*@param x - input array
260-
*@param options - function options
261-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
262-
*@param options.cache - cache for resolving array index objects
263-
*@returns fancy array
264165
*
265166
*@example
266167
* var Uint8Array = require( '@stdlib/array-uint8' );
@@ -272,17 +173,6 @@ interface Array2Fancy {
272173
*
273174
* var v = y[ ':' ];
274175
* // returns <Uint8Array>[ 1, 2, 3, 4 ]
275-
*/
276-
(x:Uint8Array,options?:Options):Uint8Array;
277-
278-
/**
279-
* Converts an array to an object supporting fancy indexing.
280-
*
281-
*@param x - input array
282-
*@param options - function options
283-
*@param options.strict - boolean indicating whether to enforce strict bounds checking
284-
*@param options.cache - cache for resolving array index objects
285-
*@returns fancy array
286176
*
287177
*@example
288178
* var Uint8ClampedArray = require( '@stdlib/array-uint8c' );
@@ -295,7 +185,7 @@ interface Array2Fancy {
295185
* var v = y[ ':' ];
296186
* // returns <Uint8ClampedArray>[ 1, 2, 3, 4 ]
297187
*/
298-
(x:Uint8ClampedArray,options?:Options):Uint8ClampedArray;
188+
<TextendsTypedArray|ComplexTypedArray|BooleanTypedArray>(x:T,options?:Options):T;
299189

300190
/**
301191
* Converts an array to an object supporting fancy indexing.

‎docs/types/test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import array2fancy = require( './index' );
3838
array2fancy(newUint8ClampedArray([1,2,3]));// $ExpectType Uint8ClampedArray
3939
array2fancy(newComplex128Array([1,2,3,4,5,6]));// $ExpectType Complex128Array
4040
array2fancy(newComplex64Array([1,2,3,4,5,6]));// $ExpectType Complex64Array
41+
array2fancy(newBooleanArray([true,false,true]));// $ExpectType BooleanArray
4142

4243
constopts={
4344
'strict':true
@@ -54,6 +55,7 @@ import array2fancy = require( './index' );
5455
array2fancy(newUint8ClampedArray([1,2,3]),opts);// $ExpectType Uint8ClampedArray
5556
array2fancy(newComplex128Array([1,2,3,4,5,6]),opts);// $ExpectType Complex128Array
5657
array2fancy(newComplex64Array([1,2,3,4,5,6]),opts);// $ExpectType Complex64Array
58+
array2fancy(newBooleanArray([true,false,true]),opts);// $ExpectType BooleanArray
5759
}
5860

5961
// The compiler throws an error if the function is provided a first argument which is not an array-like value...

‎examples/index.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
varUint8Array=require('@stdlib/array-uint8');
2222
varInt32Array=require('@stdlib/array-int32');
23+
varBooleanArray=require('@stdlib/array-bool');
2324
vararray2fancy=require('./../lib');
2425

2526
varx=[1,2,3,4,5,6];
@@ -63,6 +64,11 @@ z = y[ i ];
6364
console.log(z);
6465
// => [ 1, -9, -8, 6 ]
6566

67+
i=idx(newBooleanArray([true,false,false,true,true,true]));// boolean array
68+
z=y[i];
69+
console.log(z);
70+
// => [ 1, -9, -8, 6 ]
71+
6672
i=idx(newUint8Array([0,0,1,0,0,1]));// mask array
6773
z=y[i];
6874
console.log(z);

‎lib/get_elements.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ var prop2array = require( './prop2array.js' );
3636
*@param {Object} target - target object
3737
*@param {string} property - index string
3838
*@param {Object} ctx - context object
39-
*@param {boolean} ctx.strict - boolean indicating whether to enforce strict bounds checking
4039
*@param {Object} ctx.cache - cache for resolving array index objects
4140
*@param {Function} ctx.postGetArray - function to process a retrieved array
4241
*@throws {Error} invalid array index

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp