Skip to content

Commit 377ae31

Browse files
stdlib-botkgryte
andauthored
feat: update namespace TypeScript declarations
PR-URL: stdlib-js#1076 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent d1ded85 commit 377ae31

File tree

4 files changed

+351
-6
lines changed

4 files changed

+351
-6
lines changed

lib/node_modules/@stdlib/array/base/docs/types/index.d.ts

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,18 @@ import copy = require( '@stdlib/array/base/copy' );
3434
import copyIndexed = require( '@stdlib/array/base/copy-indexed' );
3535
import filled = require( '@stdlib/array/base/filled' );
3636
import filledBy = require( '@stdlib/array/base/filled-by' );
37+
import flatten = require( '@stdlib/array/base/flatten' );
38+
import flatten2d = require( '@stdlib/array/base/flatten2d' );
39+
import flatten2dBy = require( '@stdlib/array/base/flatten2d-by' );
40+
import flatten3d = require( '@stdlib/array/base/flatten3d' );
41+
import flatten3dBy = require( '@stdlib/array/base/flatten3d-by' );
42+
import flatten4d = require( '@stdlib/array/base/flatten4d' );
43+
import flatten4dBy = require( '@stdlib/array/base/flatten4d-by' );
44+
import flatten5d = require( '@stdlib/array/base/flatten5d' );
45+
import flatten5dBy = require( '@stdlib/array/base/flatten5d-by' );
3746
import getter = require( '@stdlib/array/base/getter' );
3847
import incrspace = require( '@stdlib/array/base/incrspace' );
48+
import last = require( '@stdlib/array/base/last' );
3949
import linspace = require( '@stdlib/array/base/linspace' );
4050
import logspace = require( '@stdlib/array/base/logspace' );
4151
import nCartesianProduct = require( '@stdlib/array/base/n-cartesian-product' );
@@ -308,6 +318,278 @@ interface Namespace {
308318
*/
309319
filledBy: typeof filledBy;
310320

321+
/**
322+
* Flattens an n-dimensional nested array.
323+
*
324+
* ## Notes
325+
*
326+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
327+
*
328+
* @param x - input array
329+
* @param shape - array shape
330+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
331+
* @returns flattened array
332+
*
333+
* @example
334+
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
335+
*
336+
* var out = ns.flatten( x, [ 2, 2 ], false );
337+
* // returns [ 1, 2, 3, 4 ]
338+
*
339+
* @example
340+
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
341+
*
342+
* var out = ns.flatten( x, [ 2, 2 ], true );
343+
* // returns [ 1, 3, 2, 4 ]
344+
*/
345+
flatten: typeof flatten;
346+
347+
/**
348+
* Flattens a two-dimensional nested array.
349+
*
350+
* ## Notes
351+
*
352+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
353+
*
354+
* @param x - input array
355+
* @param shape - array shape
356+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
357+
* @returns flattened array
358+
*
359+
* @example
360+
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
361+
*
362+
* var out = ns.flatten2d( x, [ 2, 2 ], false );
363+
* // returns [ 1, 2, 3, 4 ]
364+
*
365+
* @example
366+
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
367+
*
368+
* var out = ns.flatten2d( x, [ 2, 2 ], true );
369+
* // returns [ 1, 3, 2, 4 ]
370+
*/
371+
flatten2d: typeof flatten2d;
372+
373+
/**
374+
* Flattens a two-dimensional nested array according to a callback function.
375+
*
376+
* ## Notes
377+
*
378+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
379+
*
380+
* @param x - input array
381+
* @param shape - array shape
382+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
383+
* @param clbk - callback function
384+
* @param thisArg - callback execution context
385+
* @returns flattened array
386+
*
387+
* @example
388+
* function scale( v ) {
389+
* return v * 2;
390+
* }
391+
*
392+
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
393+
*
394+
* var out = ns.flatten2dBy( x, [ 2, 2 ], false, scale );
395+
* // returns [ 2, 4, 6, 8 ]
396+
*
397+
* @example
398+
* function scale( v ) {
399+
* return v * 2;
400+
* }
401+
*
402+
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
403+
*
404+
* var out = ns.flatten2dBy( x, [ 2, 2 ], true, scale );
405+
* // returns [ 2, 6, 4, 8 ]
406+
*/
407+
flatten2dBy: typeof flatten2dBy;
408+
409+
/**
410+
* Flattens a three-dimensional nested array.
411+
*
412+
* ## Notes
413+
*
414+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
415+
*
416+
* @param x - input array
417+
* @param shape - array shape
418+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
419+
* @returns flattened array
420+
*
421+
* @example
422+
* var x = [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ];
423+
*
424+
* var out = ns.flatten3d( x, [ 2, 1, 2 ], false );
425+
* // returns [ 1, 2, 3, 4 ]
426+
*
427+
* @example
428+
* var x = [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ];
429+
*
430+
* var out = ns.flatten3d( x, [ 2, 1, 2 ], true );
431+
* // returns [ 1, 3, 2, 4 ]
432+
*/
433+
flatten3d: typeof flatten3d;
434+
435+
/**
436+
* Flattens a three-dimensional nested array according to a callback function.
437+
*
438+
* ## Notes
439+
*
440+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
441+
*
442+
* @param x - input array
443+
* @param shape - array shape
444+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
445+
* @param clbk - callback function
446+
* @param thisArg - callback execution context
447+
* @returns flattened array
448+
*
449+
* @example
450+
* var x = [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ];
451+
*
452+
* function scale( v ) {
453+
* return v * 2;
454+
* }
455+
*
456+
* var out = ns.flatten3dBy( x, [ 2, 1, 2 ], false, scale );
457+
* // returns [ 2, 4, 6, 8 ]
458+
*
459+
* @example
460+
* var x = [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ];
461+
*
462+
* function scale( v ) {
463+
* return v * 2;
464+
* }
465+
*
466+
* var out = ns.flatten3dBy( x, [ 2, 1, 2 ], true, scale );
467+
* // returns [ 2, 6, 4, 8 ]
468+
*/
469+
flatten3dBy: typeof flatten3dBy;
470+
471+
/**
472+
* Flattens a four-dimensional nested array.
473+
*
474+
* ## Notes
475+
*
476+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
477+
*
478+
* @param x - input array
479+
* @param shape - array shape
480+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
481+
* @returns flattened array
482+
*
483+
* @example
484+
* var x = [ [ [ [ 1, 2 ] ] ], [ [ [ 3, 4 ] ] ] ];
485+
*
486+
* var out = ns.flatten4d( x, [ 2, 1, 1, 2 ], false );
487+
* // returns [ 1, 2, 3, 4 ]
488+
*
489+
* @example
490+
* var x = [ [ [ [ 1, 2 ] ] ], [ [ [ 3, 4 ] ] ] ];
491+
*
492+
* var out = ns.flatten4d( x, [ 2, 1, 1, 2 ], true );
493+
* // returns [ 1, 3, 2, 4 ]
494+
*/
495+
flatten4d: typeof flatten4d;
496+
497+
/**
498+
* Flattens a four-dimensional nested array according to a callback function.
499+
*
500+
* ## Notes
501+
*
502+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
503+
*
504+
* @param x - input array
505+
* @param shape - array shape
506+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
507+
* @returns flattened array
508+
*
509+
* @example
510+
* function scale( v ) {
511+
* return v * 2;
512+
* }
513+
*
514+
* var x = [ [ [ [ 1, 2 ] ] ], [ [ [ 3, 4 ] ] ] ];
515+
*
516+
* var out = ns.flatten4dBy( x, [ 2, 1, 1, 2 ], false, scale );
517+
* // returns [ 2, 4, 6, 8 ]
518+
*
519+
* @example
520+
* function scale( v ) {
521+
* return v * 2;
522+
* }
523+
*
524+
* var x = [ [ [ [ 1, 2 ] ] ], [ [ [ 3, 4 ] ] ] ];
525+
*
526+
* var out = ns.flatten4dBy( x, [ 2, 1, 1, 2 ], true, scale );
527+
* // returns [ 2, 6, 4, 8 ]
528+
*/
529+
flatten4dBy: typeof flatten4dBy;
530+
531+
/**
532+
* Flattens a five-dimensional nested array.
533+
*
534+
* ## Notes
535+
*
536+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
537+
*
538+
* @param x - input array
539+
* @param shape - array shape
540+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
541+
* @returns flattened array
542+
*
543+
* @example
544+
* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];
545+
*
546+
* var out = ns.flatten5d( x, [ 2, 1, 1, 1, 2 ], false );
547+
* // returns [ 1, 2, 3, 4 ]
548+
*
549+
* @example
550+
* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];
551+
*
552+
* var out = ns.flatten5d( x, [ 2, 1, 1, 1, 2 ], true );
553+
* // returns [ 1, 3, 2, 4 ]
554+
*/
555+
flatten5d: typeof flatten5d;
556+
557+
/**
558+
* Flattens a five-dimensional nested array according to a callback function.
559+
*
560+
* ## Notes
561+
*
562+
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
563+
*
564+
* @param x - input array
565+
* @param shape - array shape
566+
* @param colexicographic - specifies whether to flatten array values in colexicographic order
567+
* @param clbk - callback function
568+
* @param thisArg - callback execution context
569+
* @returns flattened array
570+
*
571+
* @example
572+
* function scale( v ) {
573+
* return v * 2;
574+
* }
575+
*
576+
* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];
577+
*
578+
* var out = ns.flatten5dBy( x, [ 2, 1, 1, 1, 2 ], false, scale );
579+
* // returns [ 1, 2, 3, 4 ]
580+
*
581+
* @example
582+
* function scale( v ) {
583+
* return v * 2;
584+
* }
585+
*
586+
* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];
587+
*
588+
* var out = ns.flatten5dBy( x, [ 2, 1, 1, 1, 2 ], true, scale );
589+
* // returns [ 1, 3, 2, 4 ]
590+
*/
591+
flatten5dBy: typeof flatten5dBy;
592+
311593
/**
312594
* Returns an accessor function for retrieving an element from an indexed array-like object.
313595
*
@@ -339,6 +621,20 @@ interface Namespace {
339621
*/
340622
incrspace: typeof incrspace;
341623

624+
/**
625+
* Returns the last element of an array-like object.
626+
*
627+
* @param arr - input array
628+
* @returns last element
629+
*
630+
* @example
631+
* var arr = [ 1, 2, 3 ];
632+
*
633+
* var out = ns.last( x );
634+
* // returns 3
635+
*/
636+
last: typeof last;
637+
342638
/**
343639
* Generates a linearly spaced numeric array.
344640
*

lib/node_modules/@stdlib/nlp/docs/types/index.d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import expandContractions = require( '@stdlib/nlp/expand-contractions' );
2626
import lda = require( '@stdlib/nlp/lda' );
2727
import ordinalize = require( '@stdlib/nlp/ordinalize' );
2828
import porterStemmer = require( '@stdlib/nlp/porter-stemmer' );
29+
import sentencize = require( '@stdlib/nlp/sentencize' );
2930
import tokenize = require( '@stdlib/nlp/tokenize' );
3031

3132
/**
@@ -142,6 +143,29 @@ interface Namespace {
142143
*/
143144
porterStemmer: typeof porterStemmer;
144145

146+
/**
147+
* Splits a string into an array of sentences.
148+
*
149+
* @param str - input string
150+
* @returns array of sentences
151+
*
152+
* @example
153+
* var str = 'Hello World! How are you?';
154+
* var out = ns.sentencize( str );
155+
* // returns [ 'Hello World!', 'How are you?' ]
156+
*
157+
* @example
158+
* var str = '';
159+
* var out = ns.sentencize( str );
160+
* // returns []
161+
*
162+
* @example
163+
* var str = 'Hello Mrs. Maple, could you call me back?';
164+
* var out = ns.sentencize( str );
165+
* // returns [ 'Hello Mrs. Maple, could you call me back?' ]
166+
*/
167+
sentencize: typeof sentencize;
168+
145169
/**
146170
* Tokenize a string.
147171
*

lib/node_modules/@stdlib/object/docs/types/index.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,39 @@
2121
/* tslint:disable:max-line-length */
2222
/* tslint:disable:max-file-line-count */
2323

24+
import assign = require( '@stdlib/object/assign' );
2425
import Object = require( '@stdlib/object/ctor' );
2526

2627
/**
2728
* Interface describing the `object` namespace.
2829
*/
2930
interface Namespace {
31+
/**
32+
* Copies own enumerable properties from one or more source objects to a target object.
33+
*
34+
* ## Notes
35+
*
36+
* - If a property key is present in multiple sources, the property from the last source that defines the key prevails.
37+
* - The target object is mutated.
38+
*
39+
* @param target - target object
40+
* @param source - source object(s)
41+
* @throws first argument must not be null or undefined
42+
* @returns target object
43+
*
44+
* @example
45+
* var obj1 = {
46+
* 'a': 'beep'
47+
* };
48+
* var obj2 = {
49+
* 'b': 'boop'
50+
* };
51+
*
52+
* var out = ns.assign( obj1, obj2 );
53+
* // returns { 'a': 'beep', 'b': 'boop' }
54+
*/
55+
assign: typeof assign;
56+
3057
/**
3158
* Returns an object.
3259
*

0 commit comments

Comments
 (0)