@danielsimonjr/mathts-core 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZPGSJR5L.js → chunk-AMOHH5MP.js} +2407 -2297
- package/dist/{index-DpOizJsa.d.ts → index-zKEDY9aj.d.ts} +29 -1
- package/dist/index.d.ts +715 -2
- package/dist/index.js +349 -41
- package/dist/internal.d.ts +2 -30
- package/dist/internal.js +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { F as FactoryFunction$1 } from './index-zKEDY9aj.js';
|
|
2
|
+
export { U as Unit, a as UnitInstance, i as isUnitValue } from './index-zKEDY9aj.js';
|
|
2
3
|
import { TypedInstance, ReferTo, ReferToSelf, TypedFunction, SignatureFunction } from 'typed-function';
|
|
3
4
|
export { ReferTo, ReferToSelf, SignatureFunction, TypedFunction, TypedInstance, create, default as typed } from 'typed-function';
|
|
4
5
|
|
|
@@ -417,6 +418,718 @@ declare const COMPLEX_ZERO: Complex;
|
|
|
417
418
|
declare const COMPLEX_ONE: Complex;
|
|
418
419
|
declare const COMPLEX_NEG_ONE: Complex;
|
|
419
420
|
|
|
421
|
+
interface BigNumber$1 {
|
|
422
|
+
toNumber(): number;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Callback function for Range forEach operations
|
|
426
|
+
*/
|
|
427
|
+
type RangeForEachCallback = (value: number, index: number[], range: unknown) => void;
|
|
428
|
+
/**
|
|
429
|
+
* Callback function for Range map operations
|
|
430
|
+
*/
|
|
431
|
+
type RangeMapCallback<T> = (value: number, index: number[], range: unknown) => T;
|
|
432
|
+
/**
|
|
433
|
+
* Formatting options for Range display
|
|
434
|
+
*/
|
|
435
|
+
interface RangeFormatOptions {
|
|
436
|
+
precision?: number;
|
|
437
|
+
notation?: 'fixed' | 'exponential' | 'engineering' | 'auto';
|
|
438
|
+
[key: string]: unknown;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* JSON representation of a Range
|
|
442
|
+
*/
|
|
443
|
+
interface RangeJSON {
|
|
444
|
+
mathjs: 'Range';
|
|
445
|
+
start: number;
|
|
446
|
+
end: number;
|
|
447
|
+
step: number;
|
|
448
|
+
}
|
|
449
|
+
declare const createRangeClass: FactoryFunction$1<{
|
|
450
|
+
new (start?: number | bigint | BigNumber$1 | null, end?: number | bigint | BigNumber$1 | null, step?: number | bigint | BigNumber$1 | null): {
|
|
451
|
+
/**
|
|
452
|
+
* Type identifier
|
|
453
|
+
*/
|
|
454
|
+
readonly type: string;
|
|
455
|
+
/**
|
|
456
|
+
* Range type flag
|
|
457
|
+
*/
|
|
458
|
+
readonly isRange: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Start value of the range (inclusive)
|
|
461
|
+
*/
|
|
462
|
+
start: number;
|
|
463
|
+
/**
|
|
464
|
+
* End value of the range (exclusive)
|
|
465
|
+
*/
|
|
466
|
+
end: number;
|
|
467
|
+
/**
|
|
468
|
+
* Step size for the range
|
|
469
|
+
*/
|
|
470
|
+
step: number;
|
|
471
|
+
/**
|
|
472
|
+
* Cached primitive array representation
|
|
473
|
+
*/
|
|
474
|
+
"__#private@#cache": number[] | null;
|
|
475
|
+
"__#private@#cacheStart"?: number;
|
|
476
|
+
"__#private@#cacheEnd"?: number;
|
|
477
|
+
"__#private@#cacheStep"?: number;
|
|
478
|
+
/**
|
|
479
|
+
* Create a clone of the range
|
|
480
|
+
* @return {Range} clone
|
|
481
|
+
*/
|
|
482
|
+
clone(): /*elided*/ any;
|
|
483
|
+
/**
|
|
484
|
+
* Retrieve the size of the range.
|
|
485
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
486
|
+
* @memberof Range
|
|
487
|
+
* @returns {number[]} size
|
|
488
|
+
*/
|
|
489
|
+
size(): number[];
|
|
490
|
+
/**
|
|
491
|
+
* Calculate the minimum value in the range
|
|
492
|
+
* @memberof Range
|
|
493
|
+
* @return {number | undefined} min
|
|
494
|
+
*/
|
|
495
|
+
min(): number | undefined;
|
|
496
|
+
/**
|
|
497
|
+
* Calculate the maximum value in the range
|
|
498
|
+
* @memberof Range
|
|
499
|
+
* @return {number | undefined} max
|
|
500
|
+
*/
|
|
501
|
+
max(): number | undefined;
|
|
502
|
+
/**
|
|
503
|
+
* Execute a callback function for each value in the range.
|
|
504
|
+
* @memberof Range
|
|
505
|
+
* @param {function} callback The callback method is invoked with three
|
|
506
|
+
* parameters: the value of the element, the index
|
|
507
|
+
* of the element, and the Range being traversed.
|
|
508
|
+
*/
|
|
509
|
+
forEach(callback: RangeForEachCallback): void;
|
|
510
|
+
/**
|
|
511
|
+
* Execute a callback function for each value in the Range, and return the
|
|
512
|
+
* results as an array
|
|
513
|
+
* @memberof Range
|
|
514
|
+
* @param {function} callback The callback method is invoked with three
|
|
515
|
+
* parameters: the value of the element, the index
|
|
516
|
+
* of the element, and the Matrix being traversed.
|
|
517
|
+
* @returns {Array} array
|
|
518
|
+
*/
|
|
519
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
520
|
+
/**
|
|
521
|
+
* Create an Array with a copy of the Ranges data
|
|
522
|
+
* @memberof Range
|
|
523
|
+
* @returns {Array} array
|
|
524
|
+
*/
|
|
525
|
+
toArray(): number[];
|
|
526
|
+
/**
|
|
527
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
528
|
+
* @memberof Range
|
|
529
|
+
* @returns {Array} array
|
|
530
|
+
*/
|
|
531
|
+
valueOf(): number[];
|
|
532
|
+
/**
|
|
533
|
+
* Get a string representation of the range, with optional formatting options.
|
|
534
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
535
|
+
* @memberof Range
|
|
536
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
537
|
+
* lib/utils/number:format for a
|
|
538
|
+
* description of the available
|
|
539
|
+
* options.
|
|
540
|
+
* @returns {string} str
|
|
541
|
+
*/
|
|
542
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
543
|
+
/**
|
|
544
|
+
* Get a string representation of the range.
|
|
545
|
+
* @memberof Range
|
|
546
|
+
* @returns {string}
|
|
547
|
+
*/
|
|
548
|
+
toString(): string;
|
|
549
|
+
/**
|
|
550
|
+
* Get a JSON representation of the range
|
|
551
|
+
* @memberof Range
|
|
552
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
553
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
554
|
+
*/
|
|
555
|
+
toJSON(): RangeJSON;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Parse a string into a range,
|
|
559
|
+
* The string contains the start, optional step, and end, separated by a colon.
|
|
560
|
+
* If the string does not contain a valid range, null is returned.
|
|
561
|
+
* For example str='0:2:11'.
|
|
562
|
+
* @memberof Range
|
|
563
|
+
* @param {string} str
|
|
564
|
+
* @return {Range | null} range
|
|
565
|
+
*/
|
|
566
|
+
parse(str: string): {
|
|
567
|
+
/**
|
|
568
|
+
* Type identifier
|
|
569
|
+
*/
|
|
570
|
+
readonly type: string;
|
|
571
|
+
/**
|
|
572
|
+
* Range type flag
|
|
573
|
+
*/
|
|
574
|
+
readonly isRange: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Start value of the range (inclusive)
|
|
577
|
+
*/
|
|
578
|
+
start: number;
|
|
579
|
+
/**
|
|
580
|
+
* End value of the range (exclusive)
|
|
581
|
+
*/
|
|
582
|
+
end: number;
|
|
583
|
+
/**
|
|
584
|
+
* Step size for the range
|
|
585
|
+
*/
|
|
586
|
+
step: number;
|
|
587
|
+
/**
|
|
588
|
+
* Cached primitive array representation
|
|
589
|
+
*/
|
|
590
|
+
"__#private@#cache": number[] | null;
|
|
591
|
+
"__#private@#cacheStart"?: number;
|
|
592
|
+
"__#private@#cacheEnd"?: number;
|
|
593
|
+
"__#private@#cacheStep"?: number;
|
|
594
|
+
/**
|
|
595
|
+
* Create a clone of the range
|
|
596
|
+
* @return {Range} clone
|
|
597
|
+
*/
|
|
598
|
+
clone(): /*elided*/ any;
|
|
599
|
+
/**
|
|
600
|
+
* Retrieve the size of the range.
|
|
601
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
602
|
+
* @memberof Range
|
|
603
|
+
* @returns {number[]} size
|
|
604
|
+
*/
|
|
605
|
+
size(): number[];
|
|
606
|
+
/**
|
|
607
|
+
* Calculate the minimum value in the range
|
|
608
|
+
* @memberof Range
|
|
609
|
+
* @return {number | undefined} min
|
|
610
|
+
*/
|
|
611
|
+
min(): number | undefined;
|
|
612
|
+
/**
|
|
613
|
+
* Calculate the maximum value in the range
|
|
614
|
+
* @memberof Range
|
|
615
|
+
* @return {number | undefined} max
|
|
616
|
+
*/
|
|
617
|
+
max(): number | undefined;
|
|
618
|
+
/**
|
|
619
|
+
* Execute a callback function for each value in the range.
|
|
620
|
+
* @memberof Range
|
|
621
|
+
* @param {function} callback The callback method is invoked with three
|
|
622
|
+
* parameters: the value of the element, the index
|
|
623
|
+
* of the element, and the Range being traversed.
|
|
624
|
+
*/
|
|
625
|
+
forEach(callback: RangeForEachCallback): void;
|
|
626
|
+
/**
|
|
627
|
+
* Execute a callback function for each value in the Range, and return the
|
|
628
|
+
* results as an array
|
|
629
|
+
* @memberof Range
|
|
630
|
+
* @param {function} callback The callback method is invoked with three
|
|
631
|
+
* parameters: the value of the element, the index
|
|
632
|
+
* of the element, and the Matrix being traversed.
|
|
633
|
+
* @returns {Array} array
|
|
634
|
+
*/
|
|
635
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
636
|
+
/**
|
|
637
|
+
* Create an Array with a copy of the Ranges data
|
|
638
|
+
* @memberof Range
|
|
639
|
+
* @returns {Array} array
|
|
640
|
+
*/
|
|
641
|
+
toArray(): number[];
|
|
642
|
+
/**
|
|
643
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
644
|
+
* @memberof Range
|
|
645
|
+
* @returns {Array} array
|
|
646
|
+
*/
|
|
647
|
+
valueOf(): number[];
|
|
648
|
+
/**
|
|
649
|
+
* Get a string representation of the range, with optional formatting options.
|
|
650
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
651
|
+
* @memberof Range
|
|
652
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
653
|
+
* lib/utils/number:format for a
|
|
654
|
+
* description of the available
|
|
655
|
+
* options.
|
|
656
|
+
* @returns {string} str
|
|
657
|
+
*/
|
|
658
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
659
|
+
/**
|
|
660
|
+
* Get a string representation of the range.
|
|
661
|
+
* @memberof Range
|
|
662
|
+
* @returns {string}
|
|
663
|
+
*/
|
|
664
|
+
toString(): string;
|
|
665
|
+
/**
|
|
666
|
+
* Get a JSON representation of the range
|
|
667
|
+
* @memberof Range
|
|
668
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
669
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
670
|
+
*/
|
|
671
|
+
toJSON(): RangeJSON;
|
|
672
|
+
} | null;
|
|
673
|
+
/**
|
|
674
|
+
* Instantiate a Range from a JSON object
|
|
675
|
+
* @memberof Range
|
|
676
|
+
* @param {Object} json A JSON object structured as:
|
|
677
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
678
|
+
* @return {Range}
|
|
679
|
+
*/
|
|
680
|
+
fromJSON(json: RangeJSON): {
|
|
681
|
+
/**
|
|
682
|
+
* Type identifier
|
|
683
|
+
*/
|
|
684
|
+
readonly type: string;
|
|
685
|
+
/**
|
|
686
|
+
* Range type flag
|
|
687
|
+
*/
|
|
688
|
+
readonly isRange: boolean;
|
|
689
|
+
/**
|
|
690
|
+
* Start value of the range (inclusive)
|
|
691
|
+
*/
|
|
692
|
+
start: number;
|
|
693
|
+
/**
|
|
694
|
+
* End value of the range (exclusive)
|
|
695
|
+
*/
|
|
696
|
+
end: number;
|
|
697
|
+
/**
|
|
698
|
+
* Step size for the range
|
|
699
|
+
*/
|
|
700
|
+
step: number;
|
|
701
|
+
/**
|
|
702
|
+
* Cached primitive array representation
|
|
703
|
+
*/
|
|
704
|
+
"__#private@#cache": number[] | null;
|
|
705
|
+
"__#private@#cacheStart"?: number;
|
|
706
|
+
"__#private@#cacheEnd"?: number;
|
|
707
|
+
"__#private@#cacheStep"?: number;
|
|
708
|
+
/**
|
|
709
|
+
* Create a clone of the range
|
|
710
|
+
* @return {Range} clone
|
|
711
|
+
*/
|
|
712
|
+
clone(): /*elided*/ any;
|
|
713
|
+
/**
|
|
714
|
+
* Retrieve the size of the range.
|
|
715
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
716
|
+
* @memberof Range
|
|
717
|
+
* @returns {number[]} size
|
|
718
|
+
*/
|
|
719
|
+
size(): number[];
|
|
720
|
+
/**
|
|
721
|
+
* Calculate the minimum value in the range
|
|
722
|
+
* @memberof Range
|
|
723
|
+
* @return {number | undefined} min
|
|
724
|
+
*/
|
|
725
|
+
min(): number | undefined;
|
|
726
|
+
/**
|
|
727
|
+
* Calculate the maximum value in the range
|
|
728
|
+
* @memberof Range
|
|
729
|
+
* @return {number | undefined} max
|
|
730
|
+
*/
|
|
731
|
+
max(): number | undefined;
|
|
732
|
+
/**
|
|
733
|
+
* Execute a callback function for each value in the range.
|
|
734
|
+
* @memberof Range
|
|
735
|
+
* @param {function} callback The callback method is invoked with three
|
|
736
|
+
* parameters: the value of the element, the index
|
|
737
|
+
* of the element, and the Range being traversed.
|
|
738
|
+
*/
|
|
739
|
+
forEach(callback: RangeForEachCallback): void;
|
|
740
|
+
/**
|
|
741
|
+
* Execute a callback function for each value in the Range, and return the
|
|
742
|
+
* results as an array
|
|
743
|
+
* @memberof Range
|
|
744
|
+
* @param {function} callback The callback method is invoked with three
|
|
745
|
+
* parameters: the value of the element, the index
|
|
746
|
+
* of the element, and the Matrix being traversed.
|
|
747
|
+
* @returns {Array} array
|
|
748
|
+
*/
|
|
749
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
750
|
+
/**
|
|
751
|
+
* Create an Array with a copy of the Ranges data
|
|
752
|
+
* @memberof Range
|
|
753
|
+
* @returns {Array} array
|
|
754
|
+
*/
|
|
755
|
+
toArray(): number[];
|
|
756
|
+
/**
|
|
757
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
758
|
+
* @memberof Range
|
|
759
|
+
* @returns {Array} array
|
|
760
|
+
*/
|
|
761
|
+
valueOf(): number[];
|
|
762
|
+
/**
|
|
763
|
+
* Get a string representation of the range, with optional formatting options.
|
|
764
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
765
|
+
* @memberof Range
|
|
766
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
767
|
+
* lib/utils/number:format for a
|
|
768
|
+
* description of the available
|
|
769
|
+
* options.
|
|
770
|
+
* @returns {string} str
|
|
771
|
+
*/
|
|
772
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
773
|
+
/**
|
|
774
|
+
* Get a string representation of the range.
|
|
775
|
+
* @memberof Range
|
|
776
|
+
* @returns {string}
|
|
777
|
+
*/
|
|
778
|
+
toString(): string;
|
|
779
|
+
/**
|
|
780
|
+
* Get a JSON representation of the range
|
|
781
|
+
* @memberof Range
|
|
782
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
783
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
784
|
+
*/
|
|
785
|
+
toJSON(): RangeJSON;
|
|
786
|
+
};
|
|
787
|
+
}>;
|
|
788
|
+
/**
|
|
789
|
+
* Ready-made `Range` class (the factory instantiated with no dependencies),
|
|
790
|
+
* exported for direct use from the package index — mirrors how core ships a
|
|
791
|
+
* ready-made `Complex`/`Fraction`/`Unit` alongside its factory.
|
|
792
|
+
*/
|
|
793
|
+
declare const Range: {
|
|
794
|
+
new (start?: number | bigint | BigNumber$1 | null, end?: number | bigint | BigNumber$1 | null, step?: number | bigint | BigNumber$1 | null): {
|
|
795
|
+
/**
|
|
796
|
+
* Type identifier
|
|
797
|
+
*/
|
|
798
|
+
readonly type: string;
|
|
799
|
+
/**
|
|
800
|
+
* Range type flag
|
|
801
|
+
*/
|
|
802
|
+
readonly isRange: boolean;
|
|
803
|
+
/**
|
|
804
|
+
* Start value of the range (inclusive)
|
|
805
|
+
*/
|
|
806
|
+
start: number;
|
|
807
|
+
/**
|
|
808
|
+
* End value of the range (exclusive)
|
|
809
|
+
*/
|
|
810
|
+
end: number;
|
|
811
|
+
/**
|
|
812
|
+
* Step size for the range
|
|
813
|
+
*/
|
|
814
|
+
step: number;
|
|
815
|
+
/**
|
|
816
|
+
* Cached primitive array representation
|
|
817
|
+
*/
|
|
818
|
+
"__#private@#cache": number[] | null;
|
|
819
|
+
"__#private@#cacheStart"?: number;
|
|
820
|
+
"__#private@#cacheEnd"?: number;
|
|
821
|
+
"__#private@#cacheStep"?: number;
|
|
822
|
+
/**
|
|
823
|
+
* Create a clone of the range
|
|
824
|
+
* @return {Range} clone
|
|
825
|
+
*/
|
|
826
|
+
clone(): /*elided*/ any;
|
|
827
|
+
/**
|
|
828
|
+
* Retrieve the size of the range.
|
|
829
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
830
|
+
* @memberof Range
|
|
831
|
+
* @returns {number[]} size
|
|
832
|
+
*/
|
|
833
|
+
size(): number[];
|
|
834
|
+
/**
|
|
835
|
+
* Calculate the minimum value in the range
|
|
836
|
+
* @memberof Range
|
|
837
|
+
* @return {number | undefined} min
|
|
838
|
+
*/
|
|
839
|
+
min(): number | undefined;
|
|
840
|
+
/**
|
|
841
|
+
* Calculate the maximum value in the range
|
|
842
|
+
* @memberof Range
|
|
843
|
+
* @return {number | undefined} max
|
|
844
|
+
*/
|
|
845
|
+
max(): number | undefined;
|
|
846
|
+
/**
|
|
847
|
+
* Execute a callback function for each value in the range.
|
|
848
|
+
* @memberof Range
|
|
849
|
+
* @param {function} callback The callback method is invoked with three
|
|
850
|
+
* parameters: the value of the element, the index
|
|
851
|
+
* of the element, and the Range being traversed.
|
|
852
|
+
*/
|
|
853
|
+
forEach(callback: RangeForEachCallback): void;
|
|
854
|
+
/**
|
|
855
|
+
* Execute a callback function for each value in the Range, and return the
|
|
856
|
+
* results as an array
|
|
857
|
+
* @memberof Range
|
|
858
|
+
* @param {function} callback The callback method is invoked with three
|
|
859
|
+
* parameters: the value of the element, the index
|
|
860
|
+
* of the element, and the Matrix being traversed.
|
|
861
|
+
* @returns {Array} array
|
|
862
|
+
*/
|
|
863
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
864
|
+
/**
|
|
865
|
+
* Create an Array with a copy of the Ranges data
|
|
866
|
+
* @memberof Range
|
|
867
|
+
* @returns {Array} array
|
|
868
|
+
*/
|
|
869
|
+
toArray(): number[];
|
|
870
|
+
/**
|
|
871
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
872
|
+
* @memberof Range
|
|
873
|
+
* @returns {Array} array
|
|
874
|
+
*/
|
|
875
|
+
valueOf(): number[];
|
|
876
|
+
/**
|
|
877
|
+
* Get a string representation of the range, with optional formatting options.
|
|
878
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
879
|
+
* @memberof Range
|
|
880
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
881
|
+
* lib/utils/number:format for a
|
|
882
|
+
* description of the available
|
|
883
|
+
* options.
|
|
884
|
+
* @returns {string} str
|
|
885
|
+
*/
|
|
886
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
887
|
+
/**
|
|
888
|
+
* Get a string representation of the range.
|
|
889
|
+
* @memberof Range
|
|
890
|
+
* @returns {string}
|
|
891
|
+
*/
|
|
892
|
+
toString(): string;
|
|
893
|
+
/**
|
|
894
|
+
* Get a JSON representation of the range
|
|
895
|
+
* @memberof Range
|
|
896
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
897
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
898
|
+
*/
|
|
899
|
+
toJSON(): RangeJSON;
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* Parse a string into a range,
|
|
903
|
+
* The string contains the start, optional step, and end, separated by a colon.
|
|
904
|
+
* If the string does not contain a valid range, null is returned.
|
|
905
|
+
* For example str='0:2:11'.
|
|
906
|
+
* @memberof Range
|
|
907
|
+
* @param {string} str
|
|
908
|
+
* @return {Range | null} range
|
|
909
|
+
*/
|
|
910
|
+
parse(str: string): {
|
|
911
|
+
/**
|
|
912
|
+
* Type identifier
|
|
913
|
+
*/
|
|
914
|
+
readonly type: string;
|
|
915
|
+
/**
|
|
916
|
+
* Range type flag
|
|
917
|
+
*/
|
|
918
|
+
readonly isRange: boolean;
|
|
919
|
+
/**
|
|
920
|
+
* Start value of the range (inclusive)
|
|
921
|
+
*/
|
|
922
|
+
start: number;
|
|
923
|
+
/**
|
|
924
|
+
* End value of the range (exclusive)
|
|
925
|
+
*/
|
|
926
|
+
end: number;
|
|
927
|
+
/**
|
|
928
|
+
* Step size for the range
|
|
929
|
+
*/
|
|
930
|
+
step: number;
|
|
931
|
+
/**
|
|
932
|
+
* Cached primitive array representation
|
|
933
|
+
*/
|
|
934
|
+
"__#private@#cache": number[] | null;
|
|
935
|
+
"__#private@#cacheStart"?: number;
|
|
936
|
+
"__#private@#cacheEnd"?: number;
|
|
937
|
+
"__#private@#cacheStep"?: number;
|
|
938
|
+
/**
|
|
939
|
+
* Create a clone of the range
|
|
940
|
+
* @return {Range} clone
|
|
941
|
+
*/
|
|
942
|
+
clone(): /*elided*/ any;
|
|
943
|
+
/**
|
|
944
|
+
* Retrieve the size of the range.
|
|
945
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
946
|
+
* @memberof Range
|
|
947
|
+
* @returns {number[]} size
|
|
948
|
+
*/
|
|
949
|
+
size(): number[];
|
|
950
|
+
/**
|
|
951
|
+
* Calculate the minimum value in the range
|
|
952
|
+
* @memberof Range
|
|
953
|
+
* @return {number | undefined} min
|
|
954
|
+
*/
|
|
955
|
+
min(): number | undefined;
|
|
956
|
+
/**
|
|
957
|
+
* Calculate the maximum value in the range
|
|
958
|
+
* @memberof Range
|
|
959
|
+
* @return {number | undefined} max
|
|
960
|
+
*/
|
|
961
|
+
max(): number | undefined;
|
|
962
|
+
/**
|
|
963
|
+
* Execute a callback function for each value in the range.
|
|
964
|
+
* @memberof Range
|
|
965
|
+
* @param {function} callback The callback method is invoked with three
|
|
966
|
+
* parameters: the value of the element, the index
|
|
967
|
+
* of the element, and the Range being traversed.
|
|
968
|
+
*/
|
|
969
|
+
forEach(callback: RangeForEachCallback): void;
|
|
970
|
+
/**
|
|
971
|
+
* Execute a callback function for each value in the Range, and return the
|
|
972
|
+
* results as an array
|
|
973
|
+
* @memberof Range
|
|
974
|
+
* @param {function} callback The callback method is invoked with three
|
|
975
|
+
* parameters: the value of the element, the index
|
|
976
|
+
* of the element, and the Matrix being traversed.
|
|
977
|
+
* @returns {Array} array
|
|
978
|
+
*/
|
|
979
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
980
|
+
/**
|
|
981
|
+
* Create an Array with a copy of the Ranges data
|
|
982
|
+
* @memberof Range
|
|
983
|
+
* @returns {Array} array
|
|
984
|
+
*/
|
|
985
|
+
toArray(): number[];
|
|
986
|
+
/**
|
|
987
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
988
|
+
* @memberof Range
|
|
989
|
+
* @returns {Array} array
|
|
990
|
+
*/
|
|
991
|
+
valueOf(): number[];
|
|
992
|
+
/**
|
|
993
|
+
* Get a string representation of the range, with optional formatting options.
|
|
994
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
995
|
+
* @memberof Range
|
|
996
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
997
|
+
* lib/utils/number:format for a
|
|
998
|
+
* description of the available
|
|
999
|
+
* options.
|
|
1000
|
+
* @returns {string} str
|
|
1001
|
+
*/
|
|
1002
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
1003
|
+
/**
|
|
1004
|
+
* Get a string representation of the range.
|
|
1005
|
+
* @memberof Range
|
|
1006
|
+
* @returns {string}
|
|
1007
|
+
*/
|
|
1008
|
+
toString(): string;
|
|
1009
|
+
/**
|
|
1010
|
+
* Get a JSON representation of the range
|
|
1011
|
+
* @memberof Range
|
|
1012
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
1013
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
1014
|
+
*/
|
|
1015
|
+
toJSON(): RangeJSON;
|
|
1016
|
+
} | null;
|
|
1017
|
+
/**
|
|
1018
|
+
* Instantiate a Range from a JSON object
|
|
1019
|
+
* @memberof Range
|
|
1020
|
+
* @param {Object} json A JSON object structured as:
|
|
1021
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
1022
|
+
* @return {Range}
|
|
1023
|
+
*/
|
|
1024
|
+
fromJSON(json: RangeJSON): {
|
|
1025
|
+
/**
|
|
1026
|
+
* Type identifier
|
|
1027
|
+
*/
|
|
1028
|
+
readonly type: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* Range type flag
|
|
1031
|
+
*/
|
|
1032
|
+
readonly isRange: boolean;
|
|
1033
|
+
/**
|
|
1034
|
+
* Start value of the range (inclusive)
|
|
1035
|
+
*/
|
|
1036
|
+
start: number;
|
|
1037
|
+
/**
|
|
1038
|
+
* End value of the range (exclusive)
|
|
1039
|
+
*/
|
|
1040
|
+
end: number;
|
|
1041
|
+
/**
|
|
1042
|
+
* Step size for the range
|
|
1043
|
+
*/
|
|
1044
|
+
step: number;
|
|
1045
|
+
/**
|
|
1046
|
+
* Cached primitive array representation
|
|
1047
|
+
*/
|
|
1048
|
+
"__#private@#cache": number[] | null;
|
|
1049
|
+
"__#private@#cacheStart"?: number;
|
|
1050
|
+
"__#private@#cacheEnd"?: number;
|
|
1051
|
+
"__#private@#cacheStep"?: number;
|
|
1052
|
+
/**
|
|
1053
|
+
* Create a clone of the range
|
|
1054
|
+
* @return {Range} clone
|
|
1055
|
+
*/
|
|
1056
|
+
clone(): /*elided*/ any;
|
|
1057
|
+
/**
|
|
1058
|
+
* Retrieve the size of the range.
|
|
1059
|
+
* Returns an array containing one number, the number of elements in the range.
|
|
1060
|
+
* @memberof Range
|
|
1061
|
+
* @returns {number[]} size
|
|
1062
|
+
*/
|
|
1063
|
+
size(): number[];
|
|
1064
|
+
/**
|
|
1065
|
+
* Calculate the minimum value in the range
|
|
1066
|
+
* @memberof Range
|
|
1067
|
+
* @return {number | undefined} min
|
|
1068
|
+
*/
|
|
1069
|
+
min(): number | undefined;
|
|
1070
|
+
/**
|
|
1071
|
+
* Calculate the maximum value in the range
|
|
1072
|
+
* @memberof Range
|
|
1073
|
+
* @return {number | undefined} max
|
|
1074
|
+
*/
|
|
1075
|
+
max(): number | undefined;
|
|
1076
|
+
/**
|
|
1077
|
+
* Execute a callback function for each value in the range.
|
|
1078
|
+
* @memberof Range
|
|
1079
|
+
* @param {function} callback The callback method is invoked with three
|
|
1080
|
+
* parameters: the value of the element, the index
|
|
1081
|
+
* of the element, and the Range being traversed.
|
|
1082
|
+
*/
|
|
1083
|
+
forEach(callback: RangeForEachCallback): void;
|
|
1084
|
+
/**
|
|
1085
|
+
* Execute a callback function for each value in the Range, and return the
|
|
1086
|
+
* results as an array
|
|
1087
|
+
* @memberof Range
|
|
1088
|
+
* @param {function} callback The callback method is invoked with three
|
|
1089
|
+
* parameters: the value of the element, the index
|
|
1090
|
+
* of the element, and the Matrix being traversed.
|
|
1091
|
+
* @returns {Array} array
|
|
1092
|
+
*/
|
|
1093
|
+
map<T>(callback: RangeMapCallback<T>): T[];
|
|
1094
|
+
/**
|
|
1095
|
+
* Create an Array with a copy of the Ranges data
|
|
1096
|
+
* @memberof Range
|
|
1097
|
+
* @returns {Array} array
|
|
1098
|
+
*/
|
|
1099
|
+
toArray(): number[];
|
|
1100
|
+
/**
|
|
1101
|
+
* Get the primitive value of the Range, a one dimensional array
|
|
1102
|
+
* @memberof Range
|
|
1103
|
+
* @returns {Array} array
|
|
1104
|
+
*/
|
|
1105
|
+
valueOf(): number[];
|
|
1106
|
+
/**
|
|
1107
|
+
* Get a string representation of the range, with optional formatting options.
|
|
1108
|
+
* Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'
|
|
1109
|
+
* @memberof Range
|
|
1110
|
+
* @param {Object | number | function} [options] Formatting options. See
|
|
1111
|
+
* lib/utils/number:format for a
|
|
1112
|
+
* description of the available
|
|
1113
|
+
* options.
|
|
1114
|
+
* @returns {string} str
|
|
1115
|
+
*/
|
|
1116
|
+
format(options?: RangeFormatOptions | number | ((value: number) => string)): string;
|
|
1117
|
+
/**
|
|
1118
|
+
* Get a string representation of the range.
|
|
1119
|
+
* @memberof Range
|
|
1120
|
+
* @returns {string}
|
|
1121
|
+
*/
|
|
1122
|
+
toString(): string;
|
|
1123
|
+
/**
|
|
1124
|
+
* Get a JSON representation of the range
|
|
1125
|
+
* @memberof Range
|
|
1126
|
+
* @returns {Object} Returns a JSON object structured as:
|
|
1127
|
+
* `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}`
|
|
1128
|
+
*/
|
|
1129
|
+
toJSON(): RangeJSON;
|
|
1130
|
+
};
|
|
1131
|
+
};
|
|
1132
|
+
|
|
420
1133
|
declare class Dual {
|
|
421
1134
|
/** Function value (the real part). */
|
|
422
1135
|
readonly value: number;
|
|
@@ -1739,4 +2452,4 @@ declare const math: {
|
|
|
1739
2452
|
|
|
1740
2453
|
declare const VERSION = "0.1.0";
|
|
1741
2454
|
|
|
1742
|
-
export { ALL_UNITS, BASE_UNITS, BEST_PREFIXES, BIGNUMBER_E, BIGNUMBER_LN10, BIGNUMBER_LN2, BIGNUMBER_NEG_ONE, BIGNUMBER_ONE, BIGNUMBER_PI, BIGNUMBER_TEN, BIGNUMBER_ZERO, type BackendType, BigNumber, type BigNumberConfig, COMPLEX_NEG_ONE, COMPLEX_ONE, COMPLEX_ZERO, Complex, type ConversionDef, DEFAULT_CONFIG, DERIVED_UNITS, DIMENSIONLESS, DUAL_UNARY_RULES, DimensionMismatchError, type Dimensions, Dual, type DualUnaryRule, type DualUnaryRuleName, E, FRACTION_HALF, FRACTION_NEG_ONE, FRACTION_ONE, FRACTION_QUARTER, FRACTION_THIRD, FRACTION_ZERO, type FactoryDependencies, type FactoryFunction, type FactoryImport, Fraction, FunctionRegistry, I, type IBigNumber, type IComplex, type IFraction, type IMatrix, LN10, LN2, LOG10E, LOG2E, MATHTS_CONVERSIONS, MATHTS_TYPES, type MathTSConfig, type MathTSValue, type MatrixBackend, type MatrixDimensions, type NumericScalar, type NumericType, PHI, PI, type RoundingMode, SI_PREFIXES, SQRT1_2, SQRT2, type Scalar, TAU, type TypeDef, TypeRegistry, UNIT_ALIASES, type UnitDef, UnitParseError, VERSION, abs, addScalar, createFactory, createMathTSTyped, createTypedFunction, dim, divideScalar, equal, fix, getPrefix, getUnitDef, initTypedWasm, isArray, isBigInt, isBigNumber, isBoolean, isComplex, isDenseMatrix, isDual, isFraction, isFunction, isMatrix, isNull, isNumber, isNumeric, isObject, isSparseMatrix, isString, isTypedWasmAvailable, isUndefined, isUnit, math, mathTyped, multiplyScalar, number, pow, registerNativeTypes, registry, round, subtractScalar };
|
|
2455
|
+
export { ALL_UNITS, BASE_UNITS, BEST_PREFIXES, BIGNUMBER_E, BIGNUMBER_LN10, BIGNUMBER_LN2, BIGNUMBER_NEG_ONE, BIGNUMBER_ONE, BIGNUMBER_PI, BIGNUMBER_TEN, BIGNUMBER_ZERO, type BackendType, BigNumber, type BigNumberConfig, COMPLEX_NEG_ONE, COMPLEX_ONE, COMPLEX_ZERO, Complex, type ConversionDef, DEFAULT_CONFIG, DERIVED_UNITS, DIMENSIONLESS, DUAL_UNARY_RULES, DimensionMismatchError, type Dimensions, Dual, type DualUnaryRule, type DualUnaryRuleName, E, FRACTION_HALF, FRACTION_NEG_ONE, FRACTION_ONE, FRACTION_QUARTER, FRACTION_THIRD, FRACTION_ZERO, type FactoryDependencies, type FactoryFunction, type FactoryImport, Fraction, FunctionRegistry, I, type IBigNumber, type IComplex, type IFraction, type IMatrix, LN10, LN2, LOG10E, LOG2E, MATHTS_CONVERSIONS, MATHTS_TYPES, type MathTSConfig, type MathTSValue, type MatrixBackend, type MatrixDimensions, type NumericScalar, type NumericType, PHI, PI, Range, type RangeForEachCallback, type RangeFormatOptions, type RangeJSON, type RangeMapCallback, type RoundingMode, SI_PREFIXES, SQRT1_2, SQRT2, type Scalar, TAU, type TypeDef, TypeRegistry, UNIT_ALIASES, type UnitDef, UnitParseError, VERSION, abs, addScalar, createFactory, createMathTSTyped, createRangeClass, createTypedFunction, dim, divideScalar, equal, fix, getPrefix, getUnitDef, initTypedWasm, isArray, isBigInt, isBigNumber, isBoolean, isComplex, isDenseMatrix, isDual, isFraction, isFunction, isMatrix, isNull, isNumber, isNumeric, isObject, isSparseMatrix, isString, isTypedWasmAvailable, isUndefined, isUnit, math, mathTyped, multiplyScalar, number, pow, registerNativeTypes, registry, round, subtractScalar };
|