You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"description": "Apply a ternary callback to elements in three broadcasted input arrays and assign results to elements in a three-dimensional nested output array.",
"description": "Apply a ternary callback to elements in three broadcasted input arrays and assign results to elements in a four-dimensional nested output array.",
Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.
710
+
711
+
```javascript
712
+
functionreducer( acc, v ) {
713
+
return ( acc && v );
714
+
}
715
+
716
+
var Float64ArrayFE =fixedEndianFactory( 'float64' );
717
+
718
+
var arr =newFloat64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
719
+
// returns <Float64ArrayFE>
720
+
721
+
var out =arr.reduce( reducer );
722
+
// returns 0.0
723
+
```
724
+
725
+
The reducer function is provided four arguments:
726
+
727
+
-**acc**: accumulated result.
728
+
-**value**: current array element.
729
+
-**index**: current array element index.
730
+
-**arr**: the array on which this method was called.
731
+
732
+
By default, the function initializes the accumulated result to the first element in the array and passes the second array element as `value` during the first invocation of the provided callback. To begin accumulation from a different starting value and pass in the first array element as `value` during the first invocation of the provided callback, provide an `initialValue` argument.
733
+
734
+
```javascript
735
+
functionreducer( acc, v ) {
736
+
if ( v ) {
737
+
return acc +1;
738
+
}
739
+
return acc;
740
+
}
741
+
742
+
var Float64ArrayFE =fixedEndianFactory( 'float64' );
743
+
744
+
var arr =newFloat64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the following element and returning the accumulated result upon completion.
756
+
757
+
```javascript
758
+
functionreducer( acc, v ) {
759
+
return ( acc && v );
760
+
}
761
+
762
+
var Float64ArrayFE =fixedEndianFactory( 'float64' );
763
+
764
+
var arr =newFloat64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
765
+
// returns <Float64ArrayFE>
766
+
767
+
var out =arr.reduceRight( reducer );
768
+
// returns 0.0
769
+
```
770
+
771
+
The reducer function is provided four arguments:
772
+
773
+
-**acc**: accumulated result.
774
+
-**value**: current array element.
775
+
-**index**: current array element index.
776
+
-**arr**: the array on which this method was called.
777
+
778
+
By default, the function initializes the accumulated result to the first element in the array and passes the second array element as `value` during the first invocation of the provided callback. To begin accumulation from a different starting value and pass in the first array element as `value` during the first invocation of the provided callback, provide an `initialValue` argument.
779
+
780
+
```javascript
781
+
functionreducer( acc, v ) {
782
+
if ( v ) {
783
+
return acc +1;
784
+
}
785
+
return acc;
786
+
}
787
+
788
+
var Float64ArrayFE =fixedEndianFactory( 'float64' );
789
+
790
+
var arr =newFloat64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
791
+
// returns <Float64ArrayFE>
612
792
793
+
var out =arr.reduceRight( reducer, 0 );
794
+
// returns 2
795
+
```
796
+
613
797
<aname="method-set"></a>
614
798
615
799
#### TypedArrayFE.prototype.set( arr\[, offset] )
@@ -728,6 +912,35 @@ var str = arr.toString();
728
912
// returns '1,2,3'
729
913
```
730
914
915
+
<aname="method-join"></a>
916
+
917
+
#### TypedArrayFE.prototype.join( \[separator] )
918
+
919
+
Serializes the array elements into a string, with elements separated by the specified `separator`. If no `separator` is provided, a comma (`,`) is used as the default.
920
+
921
+
```javascript
922
+
var Float64ArrayFE =fixedEndianFactory( 'float64' );
923
+
924
+
var arr =newFloat64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] );
925
+
926
+
var str =arr.join();
927
+
// returns '1,2,3'
928
+
929
+
str =arr.join( ' - ' );
930
+
// returns '1 - 2 - 3'
931
+
```
932
+
933
+
If the provided `separator` is not a string, it is coerced to a string.
934
+
935
+
```javascript
936
+
var Float64ArrayFE =fixedEndianFactory( 'float64' );
937
+
938
+
var arr =newFloat64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] );
0 commit comments