8000 Auto-generated commit · stdlib-js/utils-none-by@05fb5ba · GitHub
[go: up one dir, main page]

Skip to content

Commit 05fb5ba

Browse files
committed
Auto-generated commit
1 parent f3ee65a commit 05fb5ba

File tree

5 files changed

+17
-258
lines changed

5 files changed

+17
-258
lines changed

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-11-01T02:52:48.801Z

.github/workflows/publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ jobs:
182182
fi
183183
# Trim leading and trailing whitespace:
184184
dep=$(echo "$dep" | xargs)
185-
version="^$(npm view $dep version)"
185+
version="$(npm view $dep version)"
186+
if [[ -z "$version" ]]; then
187+
continue
188+
fi
189+
version="^$version"
186190
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
187191
mv package.json.tmp package.json
188192
done
@@ -192,7 +196,11 @@ jobs:
192196
fi
193197
# Trim leading and trailing whitespace:
194198
dep=$(echo "$dep" | xargs)
195-
version="^$(npm view $dep version)"
199+
version="$(npm view $dep version)"
200+
if [[ -z "$version" ]]; then
201+
continue
202+
fi
203+
version="^$version"
196204
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
197205
mv package.json.tmp package.json
198206
done

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Stephannie Jiménez Gacha <steff456@hotmail.com>
3737
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
3838
orimiles5 <97595296+orimiles5@users.noreply.github.com>
3939
rei2hu <reimu@reimu.ws>
40+
Robert Gislason <gztown2216@yahoo.com>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"@stdlib/types": "^0.1.0"
4444
},
4545
"devDependencies": {
46-
"@stdlib/array-float64": "^0.1.0",
46+
"@stdlib/array-float64": "^0.1.1",
4747
"@stdlib/assert-is-boolean": "^0.1.1",
4848
"@stdlib/bench": "^0.1.0",
4949
"@stdlib/math-base-assert-is-nan": "^0.1.1",

test/dist/test.js

Lines changed: 4 additions & 255 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2023 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -21,264 +21,13 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var noop = require( '@stdlib/utils-noop' ); 2934
25-
var Float64Array = require( '@stdlib/array-float64' );
26-
var noneBy = require( './../../dist' );
24+
var main = require( './../../dist' );
2725

2826

2927
// TESTS //
3028

31-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
3230
t.ok( true, __filename );
33-
t.strictEqual( typeof noneBy, 'function', 'main export is a function' );
34-
t.end();
35-
});
36-
37-
tape( 'the function throws an error if not provided a collection', function test( t ) {
38-
var values;
39-
var i;
40-
41-
values = [
42-
'5',
43-
5,
44-
NaN,
45-
true,
46-
false,
47-
null,
48-
void 0,
49-
{},
50-
function noop() {},
51-
/.*/,
52-
new Date()
53-
];
54-
55-
for ( i = 0; i < values.length; i++ ) {
56-
t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] );
57-
}
58-
t.end();
59-
60-
function badValue( value ) {
61-
return function badValue() {
62-
noneBy( value, noop );
63-
};
64-
}
65-
});
66-
67-
tape( 'the function throws an error if not provided a predicate function', function test( t ) {
68-
var values;
69-
var i;
70-
71-
values = [
72-
'5',
73-
5,
74-
NaN,
75-
true,
76-
false,
77-
null,
78-
void 0,
79-
{},
80-
[],
81-
/.*/,
82-
new Date()
83-
];
84-
85-
for ( i = 0; i < values.length; i++ ) {
86-
t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] );
87-
}
88-
t.end();
89-
90-
function badValue( value ) {
91-
return function badValue() {
92-
noneBy( [ 1, 2, 3 ], value );
93-
};
94-
}
95-
});
96-
97-
tape( 'if provided an empty collection, the function returns `true`', function test( t ) {
98-
var bool;
99-
var arr;
100-
101-
function foo() {
102-
t.fail( 'should not be invoked' );
103-
}
104-
arr = [];
105-
bool = noneBy( arr, foo );
106-
107-
t.strictEqual( bool, true, 'returns true' );
108-
t.end();
109-
});
110-
111-
tape( 'the function returns `true` if all elements fail a test (array)', function test( t ) {
112-
var bool;
113-
var arr;
114-
115-
arr = [ -1, -2, -3 ];
116-
117-
function isPositive( value ) {
118-
return ( value > 0 );
119-
}
120-
121-
bool = noneBy( arr, isPositive );
122-
123-
t.strictEqual( bool, true, 'returns true' );
124-
t.end();
125-
});
126-
127-
tape( 'the function returns `false` if one or more elements pass a test (array)', function test( t ) {
128-
var bool;
129-
var arr;
130-
131-
arr = [ -1, 2, -3 ];
132-
133-
function isPositive( value ) {
134-
return ( value > 0 );
135-
}
136-
137-
bool = noneBy( arr, isPositive );
138-
139-
t.strictEqual( bool, false, 'returns false' );
140-
t.end();
141-
});
142-
143-
tape( 'the function returns `true` if all elements fail a test (array-like object)', function test( t ) {
144-
var bool;
145-
var arr;
146-
147-
arr = {
148-
'length': 3,
149-
'0': -1,
150-
'1': -2,
151-
'2': -3
152-
};
153-
154-
function isPositive( value ) {
155-
return ( value > 0 );
156-
}
157-
158-
bool = noneBy( arr, isPositive );
159-
160-
t.strictEqual( bool, true, 'returns true' );
161-
t.end();
162-
});
163-
164-
tape( 'the function returns `false` if one or more elements pass a test (array-like object)', function test( t ) {
165-
var bool;
166-
var arr;
167-
168-
arr = {
169-
'length': 3,
170-
'0': -1,
171-
'1': 2,
172-
'2': -3
173-
};
174-
175-
function isPositive( value ) {
176-
return ( value > 0 );
177-
}
178-
179-
bool = noneBy( arr, isPositive );
180-
181-
t.strictEqual( bool, false, 'returns false' );
182-
t.end();
183-
});
184-
185-
tape( 'the function returns `true` if all elements fail a test (typed array)', function test( t ) {
186-
var bool;
187-
var arr;
188-
189-
arr = new Float64Array( [ -1.0, -2.0, -3.0 ] );
190-
191-
function isPositive( value ) {
192-
return ( value > 0 );
193-
}
194-
195-
bool = noneBy( arr, isPositive );
196-
197-
t.strictEqual( bool, true, 'returns true' );
198-
t.end();
199-
});
200-
201-
tape( 'the function returns `false` if one or more elements pass a test (typed array)', function test( t ) {
202-
var bool;
203-
var arr;
204-
205-
arr = new Float64Array( [ -1.0, 2.0, -3.0 ] );
206-
207-
function isPositive( value ) {
208-
return ( value > 0 );
209-
}
210-
211-
bool = noneBy( arr, isPositive );
212-
213-
t.strictEqual( bool, false, 'returns false' );
214-
t.end();
215-
});
216-
217-
tape( 'the function supports providing an execution context', function test( t ) {
218-
var bool;
219-
var ctx;
220-
var arr;
221-
222-
function sum( value ) {
223-
/* eslint-disable no-invalid-this */
224-
if ( value < 0 ) {
225-
return false;
226-
}
227-
this.sum += value;
228-
this.count += 1;
229-
return false;
230-
}
231-
232-
ctx = {
233-
'sum': 0,
234-
'count': 0
235-
};
236-
arr = [ 1.0, 2.0, 3.0 ];
237-
238-
bool = noneBy( arr, sum, ctx );
239-
240-
t.strictEqual( bool, true, 'returns true' );
241-
t.strictEqual( ctx.sum/ctx.count, 2.0, 'expected result' );
242-
243-
t.end();
244-
});
245-
246-
tape( 'the function provides basic support for dynamic arrays', function test( t ) {
247-
var bool;
248-
var arr;
249-
250-
arr = [ 1, 2, 3 ];
251-
252-
function isNegative( value, index, collection ) {
253-
if ( index === collection.length-1 && collection.length < 10 ) {
254-
collection.push( index+2 );
255-
}
256-
return ( value < 0 );
257-
}
258-
259-
bool = noneBy( arr, isNegative );
260-
261-
t.deepEqual( arr, [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'expected result' );
262-
t.strictEqual( bool, true, 'returns true' );
263-
264-
t.end();
265-
});
266-
267-
tape( 'the function does not skip empty elements', function test( t ) {
268-
var expected;
269-
var bool;
270-
var arr;
271-
272-
arr = [ 1, , , 4 ]; // eslint-disable-line no-sparse-arrays
273-
expected = [ 1, void 0, void 0, 4 ];
274-
275-
function verify( value, index ) {
276-
t.strictEqual( value, expected[ index ], 'provides expected value' );
277-
return false;
278-
}
279-
280-
bool = noneBy( arr, verify );
281-
282-
t.strictEqual( bool, true, 'returns true' );
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
28332
t.end();
28433
});

0 commit comments

Comments
 (0)
0