Skip to content

Commit 976117c

Browse files
committed
Auto-generated commit
1 parent f9e01e9 commit 976117c

File tree

5 files changed

+17
-210
lines changed

5 files changed

+17
-210
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:58:33.416Z

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

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/dist/test.js

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

2323
var tape = require( 'tape' );
24-
var contains = require( './../../dist' );
24+
var main = require( './../../dist' );
2525

2626

2727
// TESTS //
2828

29-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
3030
t.ok( true, __filename );
31-
t.strictEqual( typeof contains, 'function', 'main export is a function' );
32-
t.end();
33-
});
34-
35-
tape( 'the function throws an error if the first argument is not array-like', function test( t ) {
36-
var values;
37-
var i;
38-
39-
values = [
40-
5,
41-
null,
42-
true,
43-
false,
44-
void 0,
45-
NaN,
46-
{},
47-
function noop() {}
48-
];
49-
50-
for ( i = 0; i < values.length; i++ ) {
51-
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
52-
}
53-
t.end();
54-
55-
function badValue( value ) {
56-
return function badValue() {
57-
contains( value, '' );
58-
};
59-
}
60-
});
61-
62-
tape( 'the function throws an error if not provided a second argument', function test( t ) {
63-
t.throws( badValue, Error, 'throws an error when not provided a second argument' );
64-
t.end();
65-
66-
function badValue() {
67-
return contains( 'abc' );
68-
}
69-
});
70-
71-
tape( 'the function throws an error if the first argument is a string and the second argument is not a string', function test( t ) {
72-
var values;
73-
var i;
74-
75-
values = [
76-
5,
77-
null,
78-
true,
79-
false,
80-
void 0,
81-
NaN,
82-
[],
83-
{},
84-
function noop() {}
85-
];
86-
87-
for ( i = 0; i < values.length; i++ ) {
88-
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
89-
}
90-
t.end();
91-
92-
function badValue( value ) {
93-
return function badValue() {
94-
contains( 'abc', value );
95-
};
96-
}
97-
});
98-
99-
tape( 'the function throws an error if the `position` argument is not an integer', function test( t ) {
100-
var values;
101-
var i;
102-
103-
values = [
104-
6.5,
105-
'5',
106-
null,
107-
true,
108-
false,
109-
void 0,
110-
NaN,
111-
[],
112-
{},
113-
function noop() {}
114-
];
115-
116-
for ( i = 0; i < values.length; i++ ) {
117-
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
118-
}
119-
t.end();
120-
121-
function badValue( value ) {
122-
return function badValue() {
123-
contains( 'Hello World', 'Hello', value );
124-
};
125-
}
126-
});
127-
128-
tape( 'the function returns `true` when a search string is contained in input string', function test( t ) {
129-
var out;
130-
131-
out = contains( 'Hello World', 'World' );
132-
t.equal( out, true, 'returns true' );
133-
134-
out = contains( 'Hello World', ' ' );
135-
t.equal( out, true, 'returns true' );
136-
137-
out = contains( 'Hello World', 'Hell' );
138-
t.equal( out, true, 'returns true' );
139-
140-
t.end();
141-
});
142-
143-
tape( 'the function returns `false` when a search string is not contained in input string', function test( t ) {
144-
var out;
145-
146-
out = contains( 'Hello World', 'world' );
147-
t.equal( out, false, 'returns false' );
148-
149-
out = contains( 'Hello World', '\t' );
150-
t.equal( out, false, 'returns false' );
151-
152-
out = contains( 'Hello World', 'Word' );
153-
t.equal( out, false, 'returns false' );
154-
155-
t.end();
156-
});
157-
158-
tape( 'the function returns `true` when a search value is contained in input array', function test( t ) {
159-
var out;
160-
161-
out = contains( [ NaN, null, 3, 'abc' ], 'abc' );
162-
t.equal( out, true, 'returns true' );
163-
164-
out = contains( [ NaN, null, 3, 'abc' ], NaN );
165-
t.equal( out, true, 'returns true' );
166-
167-
out = contains( [ NaN, null, 3, 'abc' ], null );
168-
t.equal( out, true, 'returns true' );
169-
170-
t.end();
171-
});
172-
173-
tape( 'the function returns `false` when search value is not contained in input array', function test( t ) {
174-
var out;
175-
176-
out = contains( [ NaN, null, 3, 'abc' ], 'ac' );
177-
t.equal( out, false, 'returns false' );
178-
179-
out = contains( [ NaN, null, 3, 'abc' ], false );
180-
t.equal( out, false, 'returns false' );
181-
182-
out = contains( [ NaN, null, 3, 'abc' ], 3.5 );
183-
t.equal( out, false, 'returns false' );
184-
185-
t.end();
186-
});
187-
188-
tape( 'the function supports beginning a search at the specified position', function test( t ) {
189-
var out;
190-
191-
out = contains( 'ABCDEFG', 'A', 1 );
192-
t.equal( out, false, 'returns false' );
193-
194-
out = contains( 'ABCDEFG', 'B', 1 );
195-
t.equal( out, true, 'returns true' );
196-
197-
out = contains( 'ABCDEFG', 'A', -3 );
198-
t.equal( out, true, 'returns true' );
199-
200-
out = contains( [ null, NaN, 2 ], 3, 1 );
201-
t.equal( out, false, 'returns false' );
202-
203-
out = contains( [ null, NaN, 2 ], NaN, 1 );
204-
t.equal( out, true, 'returns true' );
205-
206-
out = contains( [ null, NaN, 2 ], NaN, -3 );
207-
t.equal( out, true, 'returns true' );
208-
209-
out = contains( [ null, NaN, 2 ], NaN, 2 );
210-
t.equal( out, false, 'returns false' );
211-
212-
t.end();
213-
});
214-
215-
tape( 'the function returns `true` if provided an input string and an empty string as the search value', function test( t ) {
216-
t.equal( contains( 'abc', '' ), true, 'returns true' );
217-
t.equal( contains( '', '' ), true, 'returns true' );
218-
t.end();
219-
});
220-
221-
tape( 'the function returns `false` if provided an empty array-like value', function test( t ) {
222-
t.equal( contains( [], '' ), false, 'returns false' );
223-
t.end();
224-
});
225-
226-
tape( 'the function does not distinguish between positive and negative zero', function test( t ) {
227-
t.equal( contains( [ -0.0 ], +0.0 ), true, 'returns true' );
228-
t.equal( contains( [ +0.0 ], -0.0 ), true, 'returns true' );
229-
t.end();
230-
});
231-
232-
tape( 'the function returns `false` if provided a position which exceeds the maximum index', function test( t ) {
233-
t.equal( contains( [ 1 ], 1, 1e5 ), false, 'returns false' );
234-
t.equal( contains( 'abc', 'a', 1e5 ), false, 'returns false' );
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
23532
t.end();
23633
});

0 commit comments

Comments
 (0)