-
-
Notifications
You must be signed in to change notification settings - Fork 400
/
index.d.ts
6307 lines (6085 loc) · 181 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* @license Apache-2.0
*
* Copyright (c) 2021 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.
*/
// TypeScript Version: 2.0
/* tslint:disable:max-line-length */
/* tslint:disable:max-file-line-count */
import any = require( '@stdlib/utils/any' );
import anyBy = require( '@stdlib/utils/any-by' );
import anyByRight = require( '@stdlib/utils/any-by-right' );
import append = require( '@stdlib/utils/append' );
import argumentFunction = require( '@stdlib/utils/argument-function' );
import async = require( '@stdlib/utils/async' );
import bifurcate = require( '@stdlib/utils/bifurcate' );
import bifurcateBy = require( '@stdlib/utils/bifurcate-by' );
import bifurcateIn = require( '@stdlib/utils/bifurcate-in' );
import bifurcateOwn = require( '@stdlib/utils/bifurcate-own' );
import capitalizeKeys = require( '@stdlib/utils/capitalize-keys' );
import CircularBuffer = require( '@stdlib/utils/circular-buffer' );
import commonKeys = require( '@stdlib/utils/common-keys' );
import commonKeysIn = require( '@stdlib/utils/common-keys-in' );
import CompactAdjacencyMatrix = require( '@stdlib/utils/compact-adjacency-matrix' );
import compose = require( '@stdlib/utils/compose' );
import constantFunction = require( '@stdlib/utils/constant-function' );
import constructorName = require( '@stdlib/utils/constructor-name' );
import convertPath = require( '@stdlib/utils/convert-path' );
import copy = require( '@stdlib/utils/copy' );
import countBy = require( '@stdlib/utils/count-by' );
import curry = require( '@stdlib/utils/curry' );
import curryRight = require( '@stdlib/utils/curry-right' );
import deepGet = require( '@stdlib/utils/deep-get' );
import deepPluck = require( '@stdlib/utils/deep-pluck' );
import deepSet = require( '@stdlib/utils/deep-set' );
import setConfigurableReadOnlyAccessor = require( '@stdlib/utils/define-configurable-read-only-accessor' );
import setConfigurableReadOnly = require( '@stdlib/utils/define-configurable-read-only-property' );
import setConfigurableReadWriteAccessor = require( '@stdlib/utils/define-configurable-read-write-accessor' );
import setConfigurableWriteOnlyAccessor = require( '@stdlib/utils/define-configurable-write-only-accessor' );
import setMemoizedConfigurableReadOnly = require( '@stdlib/utils/define-memoized-configurable-read-only-property' );
import defineMemoizedProperty = require( '@stdlib/utils/define-memoized-property' );
import setMemoizedReadOnly = require( '@stdlib/utils/define-memoized-read-only-property' );
import setNonEnumerableProperty = require( '@stdlib/utils/define-nonenumerable-property' );
import setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' );
import setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
import setNonEnumerableReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' );
import setNonEnumerableWriteOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-write-only-accessor' );
import defineProperties = require( '@stdlib/utils/define-properties' );
import defineProperty = require( '@stdlib/utils/define-property' );
import setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' );
import setReadOnly = require( '@stdlib/utils/define-read-only-property' );
import setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' );
import setWriteOnlyAccessor = require( '@stdlib/utils/define-write-only-accessor' );
import dirname = require( '@stdlib/utils/dirname' );
import doUntil = require( '@stdlib/utils/do-until' );
import doUntilEach = require( '@stdlib/utils/do-until-each' );
import doUntilEachRight = require( '@stdlib/utils/do-until-each-right' );
import doWhile = require( '@stdlib/utils/do-while' );
import doWhileEach = require( '@stdlib/utils/do-while-each' );
import doWhileEachRight = require( '@stdlib/utils/do-while-each-right' );
import DoublyLinkedList = require( '@stdlib/utils/doubly-linked-list' );
import objectEntries = require( '@stdlib/utils/entries' );
import objectEntriesIn = require( '@stdlib/utils/entries-in' );
import enumerableProperties = require( '@stdlib/utils/enumerable-properties' );
import enumerablePropertiesIn = require( '@stdlib/utils/enumerable-properties-in' );
import enumerablePropertySymbols = require( '@stdlib/utils/enumerable-property-symbols' );
import enumerablePropertySymbolsIn = require( '@stdlib/utils/enumerable-property-symbols-in' );
import rescape = require( '@stdlib/utils/escape-regexp-string' );
import evil = require( '@stdlib/utils/eval' );
import every = require( '@stdlib/utils/every' );
import everyBy = require( '@stdlib/utils/every-by' );
import everyByRight = require( '@stdlib/utils/every-by-right' );
import extname = require( '@stdlib/utils/extname' );
import FIFO = require( '@stdlib/utils/fifo' );
import filterArguments = require( '@stdlib/utils/filter-arguments' );
import find = require( '@stdlib/utils/find' );
import flattenArray = require( '@stdlib/utils/flatten-array' );
import flattenObject = require( '@stdlib/utils/flatten-object' );
import forEach = require( '@stdlib/utils/for-each' );
import forEachRight = require( '@stdlib/utils/for-each-right' );
import forIn = require( '@stdlib/utils/for-in' );
import forOwn = require( '@stdlib/utils/for-own' );
import objectFromEntries = require( '@stdlib/utils/from-entries' );
import functionName = require( '@stdlib/utils/function-name' );
import functionSequence = require( '@stdlib/utils/function-sequence' );
import getPrototypeOf = require( '@stdlib/utils/get-prototype-of' );
import getGlobal = require( '@stdlib/utils/global' );
import group = require( '@stdlib/utils/group' );
import groupBy = require( '@stdlib/utils/group-by' );
import groupIn = require( '@stdlib/utils/group-in' );
import groupOwn = require( '@stdlib/utils/group-own' );
import identity = require( '@stdlib/utils/identity-function' );
import ifelse = require( '@stdlib/utils/if-else' );
import ifthen = require( '@stdlib/utils/if-then' );
import indexOf = require( '@stdlib/utils/index-of' );
import inherit = require( '@stdlib/utils/inherit' );
import inheritedEnumerableProperties = require( '@stdlib/utils/inherited-enumerable-properties' );
import inheritedEnumerablePropertySymbols = require( '@stdlib/utils/inherited-enumerable-property-symbols' );
import inheritedKeys = require( '@stdlib/utils/inherited-keys' );
import inheritedNonEnumerableProperties = require( '@stdlib/utils/inherited-nonenumerable-properties' );
import inheritedNonEnumerablePropertyNames = require( '@stdlib/utils/inherited-nonenumerable-property-names' );
import inheritedNonEnumerablePropertySymbols = require( '@stdlib/utils/inherited-nonenumerable-property-symbols' );
import inheritedProperties = require( '@stdlib/utils/inherited-properties' );
import inheritedPropertyDescriptor = require( '@stdlib/utils/inherited-property-descriptor' );
import inheritedPropertyDescriptors = require( '@stdlib/utils/inherited-property-descriptors' );
import inheritedPropertyNames = require( '@stdlib/utils/inherited-property-names' );
import inheritedPropertySymbols = require( '@stdlib/utils/inherited-property-symbols' );
import inheritedWritableProperties = require( '@stdlib/utils/inherited-writable-properties' );
import inheritedWritablePropertyNames = require( '@stdlib/utils/inherited-writable-property-names' );
import inheritedWritablePropertySymbols = require( '@stdlib/utils/inherited-writable-property-symbols' );
import inmap = require( '@stdlib/utils/inmap' );
import inmapRight = require( '@stdlib/utils/inmap-right' );
import keyBy = require( '@stdlib/utils/key-by' );
import keyByRight = require( '@stdlib/utils/key-by-right' );
import objectKeys = require( '@stdlib/utils/keys' );
import keysIn = require( '@stdlib/utils/keys-in' );
import LinkedList = require( '@stdlib/utils/linked-list' );
import lowercaseKeys = require( '@stdlib/utils/lowercase-keys' );
import map = require( '@stdlib/utils/map' );
import mapArguments = require( '@stdlib/utils/map-arguments' );
import mapFun = require( '@stdlib/utils/map-function' );
import mapKeys = require( '@stdlib/utils/map-keys' );
import mapReduce = require( '@stdlib/utils/map-reduce' );
import mapReduceRight = require( '@stdlib/utils/map-reduce-right' );
import mapRight = require( '@stdlib/utils/map-right' );
import mapValues = require( '@stdlib/utils/map-values' );
import map2 = require( '@stdlib/utils/map2' );
import map2Right = require( '@stdlib/utils/map2-right' );
import map2d = require( '@stdlib/utils/map2d' );
import map3d = require( '@stdlib/utils/map3d' );
import map4d = require( '@stdlib/utils/map4d' );
import map5d = require( '@stdlib/utils/map5d' );
import maskArguments = require( '@stdlib/utils/mask-arguments' );
import memoize = require( '@stdlib/utils/memoize' );
import merge = require( '@stdlib/utils/merge' );
import moveProperty = require( '@stdlib/utils/move-property' );
import namedtypedtuple = require( '@stdlib/utils/named-typed-tuple' );
import naryFunction = require( '@stdlib/utils/nary-function' );
import nativeClass = require( '@stdlib/utils/native-class' );
import nextTick = require( '@stdlib/utils/next-tick' );
import none = require( '@stdlib/utils/none' );
import noneBy = require( '@stdlib/utils/none-by' );
import noneByRight = require( '@stdlib/utils/none-by-right' );
import nonEnumerableProperties = require( '@stdlib/utils/nonenumerable-properties' );
import nonEnumerablePropertiesIn = require( '@stdlib/utils/nonenumerable-properties-in' );
import nonEnumerablePropertyNames = require( '@stdlib/utils/nonenumerable-property-names' );
import nonEnumerablePropertyNamesIn = require( '@stdlib/utils/nonenumerable-property-names-in' );
import nonEnumerablePropertySymbols = require( '@stdlib/utils/nonenumerable-property-symbols' );
import nonEnumerablePropertySymbolsIn = require( '@stdlib/utils/nonenumerable-property-symbols-in' );
import nonIndexKeys = require( '@stdlib/utils/nonindex-keys' );
import noop = require( '@stdlib/utils/noop' );
import objectInverse = require( '@stdlib/utils/object-inverse' );
import objectInverseBy = require( '@stdlib/utils/object-inverse-by' );
import omit = require( '@stdlib/utils/omit' );
import omitBy = require( '@stdlib/utils/omit-by' );
import openURL = require( '@stdlib/utils/open-url' );
import papply = require( '@stdlib/utils/papply' );
import papplyRight = require( '@stdlib/utils/papply-right' );
import parallel = require( '@stdlib/utils/parallel' );
import parseJSON = require( '@stdlib/utils/parse-json' );
import pick = require( '@stdlib/utils/pick' );
import pickArguments = require( '@stdlib/utils/pick-arguments' );
import pickBy = require( '@stdlib/utils/pick-by' );
import pluck = require( '@stdlib/utils/pluck' );
import pop = require( '@stdlib/utils/pop' );
import prepend = require( '@stdlib/utils/prepend' );
import properties = require( '@stdlib/utils/properties' );
import propertiesIn = require( '@stdlib/utils/properties-in' );
import propertyDescriptor = require( '@stdlib/utils/property-descriptor' );
import propertyDescriptorIn = require( '@stdlib/utils/property-descriptor-in' );
import propertyDescriptors = require( '@stdlib/utils/property-descriptors' );
import propertyDescriptorsIn = require( '@stdlib/utils/property-descriptors-in' );
import propertyNames = require( '@stdlib/utils/property-names' );
import propertyNamesIn = require( '@stdlib/utils/property-names-in' );
import propertySymbols = require( '@stdlib/utils/property-symbols' );
import propertySymbolsIn = require( '@stdlib/utils/property-symbols-in' );
import push = require( '@stdlib/utils/push' );
import realmax = require( '@stdlib/utils/real-max' );
import realmin = require( '@stdlib/utils/real-min' );
import reduce = require( '@stdlib/utils/reduce' );
import reduceRight = require( '@stdlib/utils/reduce-right' );
import reduce2d = require( '@stdlib/utils/reduce2d' );
import reFromString = require( '@stdlib/utils/regexp-from-string' );
import rejectArguments = require( '@stdlib/utils/reject-arguments' );
import reorderArguments = require( '@stdlib/utils/reorder-arguments' );
import reverseArguments = require( '@stdlib/utils/reverse-arguments' );
import safeintmax = require( '@stdlib/utils/safe-int-max' );
import safeintmin = require( '@stdlib/utils/safe-int-min' );
import shift = require( '@stdlib/utils/shift' );
import sizeOf = require( '@stdlib/utils/size-of' );
import some = require( '@stdlib/utils/some' );
import someBy = require( '@stdlib/utils/some-by' );
import someByRight = require( '@stdlib/utils/some-by-right' );
import Stack = require( '@stdlib/utils/stack' );
import tabulate = require( '@stdlib/utils/tabulate' );
import tabulateBy = require( '@stdlib/utils/tabulate-by' );
import timeit = require( '@stdlib/utils/timeit' );
import trycatch = require( '@stdlib/utils/try-catch' );
import tryFunction = require( '@stdlib/utils/try-function' );
import tryRequire = require( '@stdlib/utils/try-require' );
import trythen = require( '@stdlib/utils/try-then' );
import typemax = require( '@stdlib/utils/type-max' );
import typemin = require( '@stdlib/utils/type-min' );
import typeOf = require( '@stdlib/utils/type-of' );
import uncapitalizeKeys = require( '@stdlib/utils/uncapitalize-keys' );
import uncurry = require( '@stdlib/utils/uncurry' );
import uncurryRight = require( '@stdlib/utils/uncurry-right' );
import unshift = require( '@stdlib/utils/unshift' );
import until = require( '@stdlib/utils/until' );
import untilEach = require( '@stdlib/utils/until-each' );
import untilEachRight = require( '@stdlib/utils/until-each-right' );
import unzip = require( '@stdlib/utils/unzip' );
import uppercaseKeys = require( '@stdlib/utils/uppercase-keys' );
import objectValues = require( '@stdlib/utils/values' );
import objectValuesIn = require( '@stdlib/utils/values-in' );
import whilst = require( '@stdlib/utils/while' );
import whileEach = require( '@stdlib/utils/while-each' );
import whileEachRight = require( '@stdlib/utils/while-each-right' );
import writableProperties = require( '@stdlib/utils/writable-properties' );
import writablePropertiesIn = require( '@stdlib/utils/writable-properties-in' );
import writablePropertyNames = require( '@stdlib/utils/writable-property-names' );
import writablePropertyNamesIn = require( '@stdlib/utils/writable-property-names-in' );
import writablePropertySymbols = require( '@stdlib/utils/writable-property-symbols' );
import writablePropertySymbolsIn = require( '@stdlib/utils/writable-property-symbols-in' );
import zip = require( '@stdlib/utils/zip' );
/**
* Interface describing the `utils` namespace.
*/
interface Namespace {
/**
* Tests whether at least one element in a collection is truthy.
*
* ## Notes
*
* - The function immediately returns upon encountering a truthy value.
* - If provided an empty collection, the function returns `false`.
*
* @param collection - input collection
* @returns boolean indicating whether at least one element is truthy
*
* @example
* var arr = [ 0, 0, 0, 0, 1 ];
*
* var bool = ns.any( arr );
* // returns true
*/
any: typeof any;
/**
* Tests whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.
*
* ## Notes
*
* - The predicate function is provided three arguments:
*
* - `value`: collection value
* - `index`: collection index
* - `collection`: the input collection
*
* - The function immediately returns upon encountering a truthy return value.
*
* - If provided an empty collection, the function returns `false`.
*
* @param collection - input collection
* @param predicate - test function
* @param thisArg - execution context
* @returns boolean indicating whether at least one element passes a test
*
* @example
* function isNegative( v ) {
* return ( v < 0 );
* }
*
* var arr = [ 1, 2, 3, 4, -1 ];
*
* var bool = ns.anyBy( arr, isNegative );
* // returns true
*/
anyBy: typeof anyBy;
/**
* Tests whether at least one element in a collection passes a test implemented by a predicate function.
*
* ## Notes
*
* - The predicate function is provided three arguments:
*
* - `value`: collection value
* - `index`: collection index
* - `collection`: the input collection
*
* - The function immediately returns upon encountering a truthy return value.
*
* - If provided an empty collection, the function returns `false`.
*
* @param collection - input collection
* @param predicate - test function
* @param thisArg - execution context
* @returns boolean indicating whether at least one element passes a test
*
* @example
* function isNegative( v ) {
* return ( v < 0 );
* }
*
* var arr = [ -1, 1, 2, 3, 4 ];
*
* var bool = ns.anyByRight( arr, isNegative );
* // returns true
*/
anyByRight: typeof anyByRight;
/**
* Adds elements from one collection to the end of another collection.
*
* @param collection1 - collection
* @param collection2 - collection containing elements to add
* @returns updated collection
*
* @example
* var arr = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
*
* arr = ns.append( arr, [ 6.0, 7.0 ] );
* // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
*
* @example
* var Float64Array = require( `@stdlib/array/float64` );
*
* var arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
*
* arr = ns.append( arr, [ 6.0, 7.0 ] );
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
*/
append: typeof append;
/**
* Returns a function which always returns a specified argument.
*
* ## Notes
*
* - The input argument corresponds to the zero-based index of the argument to return.
*
* @param idx - argument index
* @throws must provide a nonnegative integer
* @returns argument function
*
* @example
* var argn = ns.argumentFunction( 1 );
*
* var v = argn( 1.0, 2.0, 3.0 );
* // returns 2.0
*
* v = argn( 'a', 'b', 'c' );
* // returns 'b'
*
* v = argn( null );
* // returns undefined
*/
argumentFunction: typeof argumentFunction;
/**
* Standard async utilities.
*/
async: typeof async;
/**
* Splits values into two groups.
*
* ## Notes
*
* - If an element in `filter` is truthy, then the corresponding element in the input collection belongs to the first group; otherwise, the collection element belongs to the second group.
* - If provided an empty collection, the function returns an empty array.
*
* @param collection - input collection
* @param options - function options
* @param options.returns - if `values`, values are returned; if `indices`, indices are returned; if `*`, both indices and values are returned (default: 'values')
* @param filter - collection indicating which group an element in the input collection belongs to
* @throws first and last arguments must be the same length
* @returns results
*
* @example
* var arr = [ 'beep', 'boop', 'foo', 'bar' ];
* var filter = [ true, true, false, true ];
*
* var opts = {
* 'returns': 'indices'
* };
*
* var out = ns.bifurcate( arr, opts, filter );
* // returns [ [ 0, 1, 3 ], [ 2 ] ]
*
* @example
* var arr = [ 'beep', 'boop', 'foo', 'bar' ];
* var filter = [ true, true, false, true ];
*
* var opts = {
* 'returns': '*'
* };
*
* var out = ns.bifurcate( arr, opts, filter );
* // returns [ [ [ 0, 'beep' ], [ 1, 'boop' ], [ 3, 'bar' ] ], [ [ 2, 'foo' ] ] ]
*/
bifurcate: typeof bifurcate;
/**
* Splits values into two groups according to a predicate function.
*
* ## Notes
*
* - When invoked, the predicate function is provided two arguments:
*
* - `value`: collection value
* - `index`: collection index
*
* - If a predicate function returns a truthy value, a collection value is placed in the first group; otherwise, a collection value is placed in the second group.
*
* - If provided an empty collection, the function returns an empty array.
*
*
* @param collection - input collection
* @param options - function options
* @param options.thisArg - execution context
* @param options.returns - if `'values'`, values are returned; if `'indices'`, indices are returned; if `'*'`, both indices and values are returned (default: 'values')
* @param predicate - predicate function indicating which group an element in the input collection belongs to
* @returns group results
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
* var arr = [ 'beep', 'boop', 'foo', 'bar' ];
*
* var opts = {
* 'returns': 'indices'
* };
* var out = ns.bifurcateBy( arr, opts, predicate );
* // returns [ [ 0, 1, 3 ], [ 2 ] ]
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
* var arr = [ 'beep', 'boop', 'foo', 'bar' ];
*
* var opts = {
* 'returns': '*'
* };
* var out = ns.bifurcateBy( arr, opts, predicate );
* // returns [ [ [ 0, 'beep' ], [ 1, 'boop' ], [ 3, 'bar' ] ], [ [ 2, 'foo' ] ] ]
*/
bifurcateBy: typeof bifurcateBy;
/**
* Splits an object's own and inherited property values into two groups according to a predicate function.
*
* ## Notes
*
* - When invoked, the predicate function is provided two arguments:
*
* - `value`: object value
* - `key`: object key
*
* - If a predicate function returns a truthy value, a value is placed in the first group; otherwise, a value is placed in the second group.
*
* - If provided an empty object with no prototype, the function returns an empty array.
*
* - The function iterates over an object's own and inherited properties.
*
* - Key iteration order is *not* guaranteed, and, thus, result order is *not* guaranteed.
*
* @param input object
* @param options - function options
* @param options.thisArg - execution context
* @param options.returns - if `'values'`, values are returned; if `'keys'`, keys are returned; if `'*'`, both keys and values are returned (default: 'values')
* @param predicate - predicate function indicating which group an element in the input object belongs to
* @returns group results
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
*
* function Foo() {
* this.a = 'beep';
* this.b = 'boop';
* return this;
* }
*
* Foo.prototype = Object.create( null );
* Foo.prototype.c = 'foo';
* Foo.prototype.d = 'bar';
*
* var obj = new Foo();
*
* var opts = {
* 'returns': 'keys'
* };
* var out = ns.bifurcateIn( obj, opts, predicate );
* // e.g., returns [ [ 'a', 'b', 'd' ], [ 'c' ] ]
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
*
* function Foo() {
* this.a = 'beep';
* this.b = 'boop';
* return this;
* }
*
* Foo.prototype = Object.create( null );
* Foo.prototype.c = 'foo';
* Foo.prototype.d = 'bar';
*
* var obj = new Foo();
*
* var opts = {
* 'returns': '*'
* };
* var out = ns.bifurcateIn( obj, opts, predicate );
* // e.g., returns [ [ [ 'a', 'beep' ], [ 'b', 'boop' ], [ 'd', 'bar' ] ], [ [ 'c', 'foo' ] ] ]
*/
bifurcateIn: typeof bifurcateIn;
/**
* Splits an object's own property values into two groups according to a predicate function.
*
* @param obj - input object
* @param options - function options
* @param options.thisArg - execution context
* @param options.returns - if `'values'`, values are returned; if `'keys'`, keys are returned; if `'*'`, both keys and values are returned
* @param predicate - predicate function indicating which group an element in the input object belongs to
* @returns group results
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
* var obj = {
* 'a': 'beep',
* 'b': 'boop',
* 'c': 'foo',
* 'd': 'bar'
* };
* var out = ns.bifurcateOwn( obj, predicate );
* // e.g., returns [ [ 'beep', 'boop', 'bar' ], [ 'foo' ] ]
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
* var obj = {
* 'a': 'beep',
* 'b': 'boop',
* 'c': 'foo',
* 'd': 'bar'
* };
* var opts = {
* 'returns': 'keys'
* };
* var out = ns.bifurcateOwn( obj, opts, predicate );
* // e.g., returns [ [ 'a', 'b', 'd' ], [ 'c' ] ]
*
* @example
* function predicate( v ) {
* return v[ 0 ] === 'b';
* }
* var obj = {
* 'a': 'beep',
* 'b': 'boop',
* 'c': 'foo',
* 'd': 'bar'
* };
* var opts = {
* 'returns': '*'
* };
* var out = ns.bifurcateOwn( obj, opts, predicate );
* // e.g., returns [ [ [ 'a', 'beep' ], [ 'b', 'boop' ], [ 'd', 'bar' ] ], [ [ 'c', 'foo' ] ] ]
*/
bifurcateOwn: typeof bifurcateOwn;
/**
* Converts the first letter of each object key to uppercase.
*
* ## Notes
*
* - The function only transforms own properties. Hence, the function does not transform inherited properties.
* - The function shallow copies key values.
*
* @param obj - source object
* @returns new object
*
* @example
* var obj1 = {
* 'aa': 1,
* 'bb': 2
* };
*
* var obj2 = ns.capitalizeKeys( obj1 );
* // returns { 'Aa': 1, 'Bb': 2 }
*/
capitalizeKeys: typeof capitalizeKeys;
/**
* Circular buffer.
*/
CircularBuffer: typeof CircularBuffer;
/**
* Returns the common own property names of two or more objects.
*
* @param obj1 - first object
* @param obj2 - second object
* @param obj - additional objects
* @returns common keys of objects
*
* @example
* var obj = {
* 'a': 1,
* 'b': 2,
* 'c': 3
* };
*
* var obj2 = {
* 'a': 1,
* 'b': 2
* };
*
* var keys = ns.commonKeys( obj, obj2 );
* // returns [ 'a', 'b' ]
*
* @example
* var obj1 = {
* 'a': 1,
* 'b': 2,
* 'c': 3
* };
*
* var obj2 = {
* 'a': 1,
* 'b': 2
* };
*
* var obj3 = {
* 'a': 1,
* };
*
* var keys = ns.commonKeys( obj1, obj2, obj3 );
* // returns [ 'a' ]
*/
commonKeys: typeof commonKeys;
/**
* Returns the common own and inherited property names of two or more objects.
*
* @param obj1 - first object
* @param obj2 - second object
* @param obj - additional objects
* @returns common keys
*
* @example
* var obj = {
* 'a': 1,
* 'b': 2,
* 'c': 3
* };
*
* var obj2 = {
* 'a': 1,
* 'b': 2
* };
*
* var keys = ns.commonKeysIn( obj, obj2 );
* // returns [ 'a', 'b' ]
*
* @example
* var obj1 = {
* 'a': 1,
* 'b': 2,
* 'c': 3
* };
*
* var obj2 = {
* 'a': 1,
* 'b': 2
* };
*
* var obj3 = {
* 'a': 1,
* };
*
* var keys = ns.commonKeysIn( obj1, obj2, obj3 );
* // returns [ 'a' ]
*/
commonKeysIn: typeof commonKeysIn;
/**
* Function composition.
*
* ## Notes
*
* - Returns a composite function. Starting from the right, the composite function evaluates each function and passes the result as an argument to the next function. The result of the leftmost function is the result of the whole.
* - Only the rightmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as unary functions.
* - The function will throw if provided fewer than two input arguments.
*
* @param fcn - functions to compose
* @throws must provide more than one argument
* @returns composite function
*
* @example
* function a( x ) {
* return 2 * x;
* }
*
* function b( x ) {
* return x + 3;
* }
*
* function c( x ) {
* return x / 5;
* }
*
* var f = ns.compose( c, b, a );
*
* var z = f( 6 );
* // returns 3
*/
compose: typeof compose;
/**
* Creates a function which always returns the same value.
*
* ## Notes
*
* - When provided an object reference, the returned `function` always returns the same reference.
*
* @param value - value to always return
* @returns constant function
*
* @example
* var fcn = ns.constantFunction( 3.14 );
*
* var v = fcn();
* // returns 3.14
*
* v = fcn();
* // returns 3.14
*
* v = fcn();
* // returns 3.14
*/
constantFunction: typeof constantFunction;
/**
* Determines the name of a value's constructor.
*
* @param v - input value
* @returns name of a value's constructor
*
* @example
* var v = ns.constructorName( 'a' );
* // returns 'String'
*
* @example
* var v = ns.constructorName( 5 );
* // returns 'Number'
*
* @example
* var v = ns.constructorName( null );
* // returns 'Null'
*
* @example
* var v = ns.constructorName( undefined );
* // returns 'Undefined'
*
* @example
* var v = ns.constructorName( function noop() {} );
* // returns 'Function'
*/
constructorName: typeof constructorName;
/**
* Converts between POSIX and Windows paths.
*
* @param from - path to convert
* @param to - output path convention
* @throws second argument must be a recognized output path convention
* @throws cannot convert a Windows extended-length path to a non-Windows path convention
* @returns converted path
*
* @example
* var p = ns.convertPath( '/c/foo/bar/beep.c', 'win32' );
* // returns 'c:\\foo\\bar\\beep.c'
*
* @example
* var p = ns.convertPath( '/c/foo/bar/beep.c', 'mixed' );
* // returns 'c:/foo/bar/beep.c'
*
* @example
* var p = ns.convertPath( 'C:\\foo\\bar\\beep.c', 'posix' );
* // returns '/c/foo/bar/beep.c'
*
* @example
* var p = ns.convertPath( 'C:\\foo\\bar\\beep.c', 'mixed' );
* // returns 'C:/foo/bar/beep.c'
*/
convertPath: typeof convertPath;
/**
* Copies or deep clones a value to an arbitrary depth.
*
* ## Notes
*
* - The implementation can handle circular references.
* - If a `Number`, `String`, or `Boolean` object is encountered, the value is cloned as a primitive. This behavior is intentional.
* - For objects, the implementation only copies enumerable keys and their associated property descriptors.
* - The implementation only checks whether basic `Objects`, `Arrays`, and class instances are extensible, sealed, and/or frozen.
* - Functions are not cloned; their reference is copied.
* - The implementation supports custom error types which are `Error` instances (e.g., ES2015 subclasses).
* - Support for copying class instances is inherently fragile. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This stated, basic copying of class instances is supported. Provided an environment which supports ES5, the implementation is greedy and performs a deep clone of any arbitrary class instance and its properties. The implementation assumes that the concept of `level` applies only to the class instance reference, but not to its internal state.
*
* @param value - value to copy
* @param level - copy depth (default: +infinity)
* @throws `level` must be a nonnegative integer
* @returns value copy
*
* @example
* var out = ns.copy( 'beep' );
* // returns 'beep'
*
* @example
* var value = [
* {
* 'a': 1,
* 'b': true,
* 'c': [ 1, 2, 3 ]
* }
* ];
* var out = ns.copy( value );
* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]
*
* var bool = ( value[0].c === out[0].c );
* // returns false
*/
copy: typeof copy;
/**
* Groups values according to an indicator function and returns group counts.
*
* ## Notes
*
* - When invoked, the indicator function is provided two arguments:
*
* - `value`: collection value
* - `index`: collection index
*
* - The value returned by an indicator function should be a value which can be serialized as an object key.
*
* - If provided an empty collection, the function returns an empty object.
*
* @param collection - input collection
* @param options - function options
* @param options.thisArg - execution context
* @param indicator - indicator function specifying which group an element in the input collection belongs to
* @returns counts
*
* @example
* function indicator( v ) {
* return v[ 0 ];
* }
* var arr = [ 'beep', 'boop', 'foo', 'bar' ];
*
* var out = ns.countBy( arr, indicator );
* // returns { 'b': 3, 'f': 1 }
*/
countBy: typeof countBy;
/**
* Transforms a function into a sequence of functions each accepting a single argument.
*
* ## Notes
*
* - Until return value resolution, each invocation returns a new partially applied curry function.
*
* @param fcn - function to curry
* @param thisArg - evaluation context
* @returns curry function
*
* @example
* function add( x, y ) {
* return x + y;
* }
*
* var f = ns.curry( add );
*
* var sum = f( 2 )( 3 );
* // returns 5
*/
curry: typeof curry;
/**
* Transforms a function into a sequence of functions each accepting a single argument.
*
* ## Notes
*
* - Until return value resolution, each invocation returns a new partially applied curry function.
* - This function applies arguments starting from the right.
*
* @param fcn - function to curry
* @param thisArg - evaluation context
* @returns curry function
*
* @example
* function add( x, y ) {
* return x + y;
* }
*
* var f = ns.curryRight( add );
*
* var sum = f( 2 )( 3 );
* // returns 5
*/
curryRight: typeof curryRight;
/**
* Returns a nested property value.
*
* @param obj - input object
* @param path - key path
* @param options - function options
* @param options.sep - key path separator (default: '.')
* @returns nested property value
*
* @example
* var obj = { 'a': { 'b': { 'c': 'd' } } };
*
* var val = ns.deepGet( obj, 'a.b.c' );
* // returns 'd'
*
* @example
* var dget = ns.deepGet.factory( 'a/b/c', {
* 'sep': '/'
* });
*
* var obj = { 'a': { 'b': { 'c': 'd' } } };
*
* var val = dget( obj );
* // returns 'd'
*/
deepGet: typeof deepGet;
/**
* Extracts a nested property value from each element of an object array.
*
* ## Notes
*
* - If a key path does not exist, the function sets the plucked value as `undefined`.
* - Extracted values are not cloned.
*
* @param arr - source array
* @param path - key path
* @param options - function options
* @param options.copy - boolean indicating whether to return a new data structure (default: true)
* @param options.sep - key path separator (default: '.')
* @returns destination array
*
* @example
* var arr = [
* {'a':{'b':{'c':1}}},
* {'a':{'b':{'c':2}}}
* ];
*
* var out = ns.deepPluck( arr, 'a.b.c' );
* // returns [ 1, 2 ]
*
* @example
* var arr = [
* {'a':[0,1,2]},
* {'a':[3,4,5]}
* ];
*
* var out = ns.deepPluck( arr, ['a',1] );
* // returns [ 1, 4 ]