-
-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathrepl.txt
100 lines (75 loc) · 2.64 KB
/
repl.txt
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
{{alias}}( fcn, value )
Tests if every element of an array passes a test condition.
The provided test function `fcn` should accept a single argument: an array
element. If the array element satisfies a test condition, the function
should return `true`; otherwise, the function should return `false`.
Given an input array, the function returns `true` if all elements pass the
test and `false` otherwise.
The function returns `false` for an empty array.
Parameters
----------
fcn: Function
Function to apply.
value: any
Value to test.
Returns
-------
bool: boolean
Boolean indicating whether a value is an array for which all elements
pass the test condition.
Examples
--------
> var arr1 = [ 1, 3, 5, 7 ];
> var arr2 = [ 3, 5, 'c' ];
> var bool = {{alias}}( {{alias:@stdlib/assert/is-odd}}, arr1 )
true
> bool = {{alias}}( {{alias:@stdlib/assert/is-odd}}, arr2 )
false
{{alias}}.create( fcn )
Creates a validation function which validates whether every element of an
array passes a test condition.
Parameters
----------
fcn: Function
Function to apply.
Returns
-------
out: Function
Validation function.
Examples
--------
> var isOddArray = {{alias}}.create( {{alias:@stdlib/assert/is-odd}} );
> var bool = isOddArray( [ 1, 3, 5 ] )
true
> bool = isOddArray( [ 2, 3, 4 ] )
false
{{alias}}.raw( fcn, value )
Tests if every element of an array passes a test condition.
The provided test function `fcn` should accept a single argument: an array
element. If the array element satisfies a test condition, the function
should return `true`; otherwise, the function should return `false`.
Given an input array, the function returns `true` if all elements pass the
test and `false` otherwise.
The function returns `false` for an empty array.
This function forgoes some of the guarantees of the above APIs, such as
input argument validation. While use of the above APIs is encouraged in the
REPL, use of the lower-level interface may be warranted when arguments are
of a known type or when performance is paramount.
Parameters
----------
fcn: Function
Function to apply.
value: any
Value to test.
Returns
-------
bool: boolean
Boolean indicating whether a value is an array for which all elements
pass the test condition.
Examples
--------
> var arr = [ 1, 1, 1, 1, 1 ];
> var bool = {{alias}}.raw( {{alias:@stdlib/assert/is-odd}}, arr )
true
See Also
--------