Skip to content

Commit 17f1aee

Browse files
chore: clean up
1 parent f59f4ad commit 17f1aee

3 files changed

Lines changed: 36 additions & 11 deletions

File tree

lib/node_modules/@stdlib/dstructs/fifo/docs/repl.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{{alias}}()
32
First-in-first-out (FIFO) queue constructor.
43

@@ -58,11 +57,11 @@
5857
> q.push( 'foo' ).push( 'bar' ).push( 'baz' );
5958
> q.length
6059
3
61-
> q[0]
60+
> q.get( 0 )
6261
'foo'
63-
> q[1]
62+
> q.get( 1 )
6463
'bar'
65-
> q[2]
64+
> q.get( 2 )
6665
'baz'
6766
> q.pop()
6867
'foo'
@@ -100,11 +99,11 @@
10099
--------
101100
> var q = {{alias}}();
102101
> q.push( 1 ).push( 2 ).push( 3 );
103-
> q.every( function predicate( v ) { return v > 0; } )
102+
> q.every( function( v ) { return v > 0; } )
104103
true
105-
> q.every( function predicate( v ) { return v > 2; } )
104+
> q.every( function( v ) { return v > 2; } )
106105
false
107-
> q.every( function predicate( v ) { return v % 2 === 0; } )
106+
> q.every( function( v ) { return v % 2 === 0; } )
108107
false
109108

110109

lib/node_modules/@stdlib/dstructs/fifo/docs/types/index.d.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ type Predicate<T, U> = NullaryPredicate<U> | UnaryPredicate<T, U> | BinaryPredic
7474
*
7575
* @template T - queue element type
7676
*/
77-
declare class FIFO<T = any> {
77+
declare class FIFO<T = unknown> {
7878
/**
7979
* First-in-first-out queue constructor.
8080
*
8181
* @returns FIFO queue instance
8282
*
8383
* @example
84+
* var FIFO = require( '@stdlib/dstructs/fifo' );
85+
*
8486
* var queue = new FIFO();
8587
*
8688
* // Add values to the queue:
@@ -105,6 +107,8 @@ declare class FIFO<T = any> {
105107
* @returns queue instance
106108
*
107109
* @example
110+
* var FIFO = require( '@stdlib/dstructs/fifo' );
111+
*
108112
* var queue = new FIFO();
109113
*
110114
* // Add values to the queue:
@@ -144,6 +148,8 @@ declare class FIFO<T = any> {
144148
* @returns boolean indicating whether all elements pass a test
145149
*
146150
* @example
151+
* var FIFO = require( '@stdlib/dstructs/fifo' );
152+
*
147153
* function predicate( v ) {
148154
* return v > 0;
149155
* }
@@ -163,6 +169,8 @@ declare class FIFO<T = any> {
163169
* @returns "oldest" queue value
164170
*
165171
* @example
172+
* var FIFO = require( '@stdlib/dstructs/fifo' );
173+
*
166174
* var queue = new FIFO();
167175
*
168176
* // Add values to the queue:
@@ -182,6 +190,8 @@ declare class FIFO<T = any> {
182190
* @returns queue element
183191
*
184192
* @example
193+
* var FIFO = require( '@stdlib/dstructs/fifo' );
194+
*
185195
* var queue = new FIFO();
186196
*
187197
* queue.push( 'foo' ).push( 'bar' );
@@ -204,6 +214,8 @@ declare class FIFO<T = any> {
204214
* @returns iterator
205215
*
206216
* @example
217+
* var FIFO = require( '@stdlib/dstructs/fifo' );
218+
*
207219
* var queue = new FIFO();
208220
*
209221
* // Add values to the queue:
@@ -230,6 +242,8 @@ declare class FIFO<T = any> {
230242
* @returns "newest" queue value
231243
*
232244
* @example
245+
* var FIFO = require( '@stdlib/dstructs/fifo' );
246+
*
233247
* var queue = new FIFO();
234248
*
235249
* // Add values to the queue:
@@ -245,6 +259,8 @@ declare class FIFO<T = any> {
245259
* Queue length.
246260
*
247261
* @example
262+
* var FIFO = require( '@stdlib/dstructs/fifo' );
263+
*
248264
* var queue = new FIFO();
249265
*
250266
* // Examine the initial queue length:
@@ -266,6 +282,8 @@ declare class FIFO<T = any> {
266282
* @returns removed value
267283
*
268284
* @example
285+
* var FIFO = require( '@stdlib/dstructs/fifo' );
286+
*
269287
* var queue = new FIFO();
270288
*
271289
* // Add values to the queue:
@@ -290,6 +308,8 @@ declare class FIFO<T = any> {
290308
* @returns queue instance
291309
*
292310
* @example
311+
* var FIFO = require( '@stdlib/dstructs/fifo' );
312+
*
293313
* var queue = new FIFO();
294314
*
295315
* // Add values to the queue:
@@ -322,6 +342,8 @@ declare class FIFO<T = any> {
322342
* @throws target queue lacks sufficient storage to accommodate source values
323343
*
324344
* @example
345+
* var FIFO = require( '@stdlib/dstructs/fifo' );
346+
*
325347
* var queue = new FIFO();
326348
*
327349
* queue.push( 'foo' ).push( 'bar' ).set( 'beep', 0 );
@@ -347,6 +369,8 @@ declare class FIFO<T = any> {
347369
* @returns queue values
348370
*
349371
* @example
372+
* var FIFO = require( '@stdlib/dstructs/fifo' );
373+
*
350374
* var queue = new FIFO();
351375
*
352376
* // Add values to the queue:
@@ -368,6 +392,8 @@ declare class FIFO<T = any> {
368392
* @returns serialized queue
369393
*
370394
* @example
395+
* var FIFO = require( '@stdlib/dstructs/fifo' );
396+
*
371397
* var queue = new FIFO();
372398
*
373399
* // Add values to the queue:
@@ -377,7 +403,7 @@ declare class FIFO<T = any> {
377403
* var o = queue.toJSON();
378404
* // returns { 'type': 'fifo', 'data': [ 'foo', 'bar' ] }
379405
*/
380-
toJSON(): any;
406+
toJSON(): { type: string; data: Array<T> };
381407
}
382408

383409

lib/node_modules/@stdlib/dstructs/fifo/lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,14 @@ setReadOnly( FIFO.prototype, 'push', function push( value ) {
524524
* // returns 'boop'
525525
*/
526526
setReadOnly( FIFO.prototype, 'set', function set( value ) {
527-
var idx;
528527
var node;
528+
var idx;
529529
var i;
530530

531531
if ( !isFIFO( this ) ) {
532532
throw new TypeError( 'invalid invocation. `this` is not a FIFO.' );
533533
}
534-
idx = arguments.length > 1 ? arguments[ 1 ] : 0;
534+
idx = ( arguments.length > 1 ) ? arguments[ 1 ] : 0;
535535
if ( !isNonNegativeInteger( idx ) ) {
536536
throw new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );
537537
}

0 commit comments

Comments
 (0)