Skip to content

Commit 466bb90

Browse files
committed
Remove string support
This is due to the need for specialized handling of multi-byte characters.
1 parent 18fae7e commit 466bb90

File tree

5 files changed

+18
-100
lines changed

5 files changed

+18
-100
lines changed

lib/node_modules/@stdlib/array/to-strided-iterator/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# Strided Iterator
2222

23-
> Create an [iterator][mdn-iterator-protocol] from a strided array-like value.
23+
> Create an [iterator][mdn-iterator-protocol] from a strided array-like object.
2424
2525
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
2626

@@ -42,7 +42,7 @@ var stridedarray2iterator = require( '@stdlib/array/to-strided-iterator' );
4242

4343
#### stridedarray2iterator( N, src, stride, offset\[, mapFcn\[, thisArg]] )
4444

45-
Returns an [iterator][mdn-iterator-protocol] which iterates over elements in an array-like value according to specified stride parameters.
45+
Returns an [iterator][mdn-iterator-protocol] which iterates over elements in an array-like `object` according to specified stride parameters.
4646

4747
```javascript
4848
var values = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
@@ -98,7 +98,7 @@ The invoked function is provided four arguments:
9898
- `value`: iterated value
9999
- `index`: iterated value index
100100
- `n`: iteration count
101-
- `src`: source array-like value
101+
- `src`: source array-like object
102102

103103
```javascript
104104
function fcn( v, i ) {

lib/node_modules/@stdlib/array/to-strided-iterator/docs/repl.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
{{alias}}( N, src, stride, offset[, mapFcn[, thisArg]] )
3-
Returns an iterator which iterates over elements of an array-like value
3+
Returns an iterator which iterates over elements of an array-like object
44
according to specified stride parameters.
55

66
When invoked, an input function is provided four arguments:
77

88
- value: iterated value
99
- index: iterated value index
1010
- n: iteration count
11-
- src: source array-like value
11+
- src: source array-like object
1212

1313
If an environment supports Symbol.iterator, the returned iterator is
1414
iterable.
@@ -23,8 +23,8 @@
2323
N: integer
2424
Number of values to iterate.
2525

26-
src: ArrayLike
27-
Array-like value from which to create the iterator.
26+
src: ArrayLikeObject
27+
Array-like object from which to create the iterator.
2828

2929
stride: integer
3030
Stride length.

lib/node_modules/@stdlib/array/to-strided-iterator/lib/main.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
2424
var isFunction = require( '@stdlib/assert/is-function' );
25-
var isArrayLike = require( '@stdlib/assert/is-array-like' );
25+
var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' );
2626
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
2727
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
2828
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
@@ -31,16 +31,16 @@ var iteratorSymbol = require( '@stdlib/symbol/iterator' );
3131
// MAIN //
3232

3333
/**
34-
* Returns an iterator which iterates over elements in an array-like value according to specified stride parameters.
34+
* Returns an iterator which iterates over elements in an array-like object according to specified stride parameters.
3535
*
3636
* @param {NonNegativeInteger} N - number of values to iterate
37-
* @param {ArrayLike} src - input value
37+
* @param {ArrayLikeObject} src - input value
3838
* @param {integer} stride - stride length
3939
* @param {NonNegativeInteger} offset - starting index
4040
* @param {Function} [mapFcn] - function to invoke for each iterated value
4141
* @param {*} [thisArg] - execution context
4242
* @throws {TypeError} first argument must be a nonnegative integer
43-
* @throws {TypeError} second argument must be array-like
43+
* @throws {TypeError} second argument must be an array-like object
4444
* @throws {TypeError} third argument must be an integer
4545
* @throws {TypeError} fourth argument must be a nonnegative integer
4646
* @throws {TypeError} fifth argument must be a function
@@ -76,8 +76,8 @@ function stridedarray2iterator( N, src, stride, offset ) {
7676
if ( !isNonNegativeInteger( N ) ) {
7777
throw new TypeError( 'invalid argument. First argument must be a nonnegative integer. Value: `' + N + '`.' );
7878
}
79-
if ( !isArrayLike( src ) ) {
80-
throw new TypeError( 'invalid argument. Second argument must be array-like. Value: `' + src + '`.' );
79+
if ( !isArrayLikeObject( src ) ) {
80+
throw new TypeError( 'invalid argument. Second argument must be an array-like object. Value: `' + src + '`.' );
8181
}
8282
if ( !isInteger( stride ) ) {
8383
throw new TypeError( 'invalid argument. Third argument must be an integer. Value: `' + stride + '`.' );

lib/node_modules/@stdlib/array/to-strided-iterator/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/array/to-strided-iterator",
33
"version": "0.0.0",
4-
"description": "Create an iterator from a strided array-like value.",
4+
"description": "Create an iterator from a strided array-like object.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

lib/node_modules/@stdlib/array/to-strided-iterator/test/test.js

+4-86
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ tape( 'the function throws an error if provided a first argument which is not a
9393
}
9494
});
9595

96-
tape( 'the function throws an error if provided a second argument which is not array-like', function test( t ) {
96+
tape( 'the function throws an error if provided a second argument which is not an array-like object', function test( t ) {
9797
var values;
9898
var i;
9999

100100
values = [
101+
'5',
101102
5,
102103
NaN,
103104
true,
@@ -120,11 +121,12 @@ tape( 'the function throws an error if provided a second argument which is not a
120121
}
121122
});
122123

123-
tape( 'the function throws an error if provided a second argument which is not array-like (callback)', function test( t ) {
124+
tape( 'the function throws an error if provided a second argument which is not an array-like object (callback)', function test( t ) {
124125
var values;
125126
var i;
126127

127128
values = [
129+
'5',
128130
5,
129131
NaN,
130132
true,
@@ -336,53 +338,6 @@ tape( 'the function returns an iterator protocol-compliant object', function tes
336338
t.end();
337339
});
338340

339-
tape( 'the function returns an iterator protocol-compliant object (string)', function test( t ) {
340-
var expected;
341-
var actual;
342-
var values;
343-
var it;
344-
var r;
345-
var i;
346-
347-
values = '12345678';
348-
expected = [
349-
{
350-
'value': '7',
351-
'done': false
352-
},
353-
{
354-
'value': '5',
355-
'done': false
356-
},
357-
{
358-
'value': '3',
359-
'done': false
360-
},
361-
{
362-
'value': '1',
363-
'done': false
364-
},
365-
{
366-
'done': true
367-
}
368-
];
369-
370-
it = stridedarray2iterator( 4, values, -2, 6 );
371-
t.equal( it.next.length, 0, 'has zero arity' );
372-
373-
actual = [];
374-
for ( i = 0; i < 4; i++ ) {
375-
r = it.next();
376-
actual.push( r );
377-
t.equal( typeof r.value, 'string', 'returns a string' );
378-
t.equal( typeof r.done, 'boolean', 'returns a boolean' );
379-
}
380-
actual.push( it.next() );
381-
382-
t.deepEqual( actual, expected, 'returns expected values' );
383-
t.end();
384-
});
385-
386341
tape( 'the function returns an iterator protocol-compliant object (array-like object)', function test( t ) {
387342
var expected;
388343
var actual;
@@ -476,43 +431,6 @@ tape( 'the function returns an iterator protocol-compliant object which supports
476431
}
477432
});
478433

479-
tape( 'the function returns an iterator protocol-compliant object which supports invoking a provided function for each iterated value (string)', function test( t ) {
480-
var expected;
481-
var values;
482-
var it;
483-
var r;
484-
var i;
485-
486-
values = '1234';
487-
488-
it = stridedarray2iterator( 4, values, 1, 0, fcn );
489-
t.equal( it.next.length, 0, 'has zero arity' );
490-
491-
expected = [
492-
'beep: 1',
493-
'beep: 2',
494-
'beep: 3',
495-
'beep: 4'
496-
];
497-
for ( i = 0; i < values.length; i++ ) {
498-
r = it.next();
499-
t.equal( r.value, expected[ i ], 'returns expected value' );
500-
t.equal( typeof r.done, 'boolean', 'returns a boolean' );
501-
}
502-
t.equal( expected.length, values.length, 'has expected length' );
503-
504-
r = it.next();
505-
t.equal( r.value, void 0, 'returns expected value' );
506-
t.equal( r.done, true, 'returns expected value' );
507-
508-
t.end();
509-
510-
function fcn( v ) {
511-
v = 'beep: ' + v;
512-
return v;
513-
}
514-
});
515-
516434
tape( 'the function returns an iterator protocol-compliant object which supports invoking a provided function for each iterated value (array-like)', function test( t ) {
517435
var expected;
518436
var values;

0 commit comments

Comments
 (0)