Skip to content

Commit 33f5ecf

Browse files
committed
Auto-generated commit
1 parent d1746cf commit 33f5ecf

File tree

4 files changed

+16
-143
lines changed

4 files changed

+16
-143
lines changed

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-11-01T01:05:20.725Z

.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>

test/dist/test.js

Lines changed: 4 additions & 141 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,150 +21,13 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var noop = require( '@stdlib/utils-noop' );
25-
var ifelseAsync = require( './../../dist' );
24+
var main = require( './../../dist' );
2625

2726

2827
// TESTS //
2928

30-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
3130
t.ok( true, __filename );
32-
t.strictEqual( typeof ifelseAsync, 'function', 'main export is a function' );
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
3332
t.end();
3433
});
35-
36-
tape( 'the function throws an error if provided a first argument which is not a function', function test( t ) {
37-
var values;
38-
var i;
39-
40-
values = [
41-
'5',
42-
5,
43-
NaN,
44-
true,
45-
false,
46-
null,
47-
void 0,
48-
[],
49-
{}
50-
];
51-
52-
for ( i = 0; i < values.length; i++ ) {
53-
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
54-
}
55-
t.end();
56-
57-
function badValue( value ) {
58-
return function badValue() {
59-
ifelseAsync( value, 1.0, -1.0, noop );
60-
};
61-
}
62-
});
63-
64-
tape( 'the function throws an error if provided a last argument which is not a function', function test( t ) {
65-
var values;
66-
var i;
67-
68-
values = [
69-
'5',
70-
5,
71-
NaN,
72-
true,
73-
false,
74-
null,
75-
void 0,
76-
[],
77-
{}
78-
];
79-
80-
for ( i = 0; i < values.length; i++ ) {
81-
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
82-
}
83-
t.end();
84-
85-
function badValue( value ) {
86-
return function badValue() {
87-
ifelseAsync( noop, 1.0, -1.0, value );
88-
};
89-
}
90-
});
91-
92-
tape( 'if a predicate function returns a truthy value, the function returns the second argument', function test( t ) {
93-
ifelseAsync( predicate, 'beep', 'boop', done );
94-
95-
function predicate( clbk ) {
96-
setTimeout( onTimeout, 0 );
97-
function onTimeout() {
98-
clbk( null, true );
99-
}
100-
}
101-
102-
function done( error, result ) {
103-
if ( error ) {
104-
t.fail( error.message );
105-
} else {
106-
t.strictEqual( result, 'beep', 'returns expected value' );
107-
}
108-
t.end();
109-
}
110-
});
111-
112-
tape( 'if a predicate function returns a falsy value, the function returns the third argument', function test( t ) {
113-
ifelseAsync( predicate, 'beep', 'boop', done );
114-
115-
function predicate( clbk ) {
116-
setTimeout( onTimeout, 0 );
117-
function onTimeout() {
118-
clbk( null, false );
119-
}
120-
}
121-
122-
function done( error, result ) {
123-
if ( error ) {
124-
t.fail( error.message );
125-
} else {
126-
t.strictEqual( result, 'boop', 'returns expected value' );
127-
}
128-
t.end();
129-
}
130-
});
131-
132-
tape( 'if a predicate function returns an error, the function returns the error', function test( t ) {
133-
ifelseAsync( predicate, 'beep', 'boop', done );
134-
135-
function predicate( clbk ) {
136-
setTimeout( onTimeout, 0 );
137-
function onTimeout() {
138-
clbk( new Error( 'beep' ) );
139-
}
140-
}
141-
142-
function done( error ) {
143-
if ( error ) {
144-
t.pass( error.message );
145-
} else {
146-
t.fail( 'should return an error' );
147-
}
148-
t.end();
149-
}
150-
});
151-
152-
tape( 'the function does not guarantee asynchronous execution', function test( t ) {
153-
var i = 0;
154-
ifelseAsync( predicate, 'beep', 'boop', done );
155-
i = 1;
156-
157-
function predicate( clbk ) {
158-
clbk( null, true );
159-
}
160-
161-
function done( error, result ) {
162-
if ( error ) {
163-
t.fail( error.message );
164-
} else {
165-
t.strictEqual( result, 'beep', 'returns expected value' );
166-
}
167-
t.strictEqual( i, 0, 'releases the zalgo' );
168-
t.end();
169-
}
170-
});

0 commit comments

Comments
 (0)