Skip to content

Commit fe22e3b

Browse files
committed
Auto-generated commit
1 parent 837f944 commit fe22e3b

File tree

5 files changed

+18
-307
lines changed

5 files changed

+18
-307
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:55:13.376Z

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
"@stdlib/types": "^0.1.0"
4646
},
4747
"devDependencies": {
48-
"@stdlib/array-float64": "^0.1.0",
48+
"@stdlib/array-float64": "^0.1.1",
4949
"@stdlib/bench": "^0.1.0",
50-
"@stdlib/math-base-special-floor": "^0.1.0",
50+
"@stdlib/math-base-special-floor": "^0.1.1",
5151
"@stdlib/random-base-randu": "^0.1.0",
5252
"@stdlib/utils-noop": "^0.1.1",
5353
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

test/dist/test.js

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

2323
var tape = require( 'tape' );
24-
var noop = require( '@stdlib/utils-noop' );
25-
var Float64Array = require( '@stdlib/array-float64' );
26-
var countBy = 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 countBy, '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-
countBy( value, noop );
63-
};
64-
}
65-
});
66-
67-
tape( 'the function throws an error if not provided an indicator function (no options)', 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-
countBy( [ 1, 2, 3 ], value );
93-
};
94-
}
95-
});
96-
97-
tape( 'the function throws an error if not provided an indicator function (options)', function test( t ) {
98-
var values;
99-
var i;
100-
101-
values = [
102-
'5',
103-
5,
104-
NaN,
105-
true,
106-
false,
107-
null,
108-
void 0,
109-
{},
110-
[],
111-
/.*/,
112-
new Date()
113-
];
114-
115-
for ( i = 0; i < values.length; i++ ) {
116-
t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] );
117-
}
118-
t.end();
119-
120-
function badValue( value ) {
121-
return function badValue() {
122-
countBy( [ 1, 2, 3 ], {}, value );
123-
};
124-
}
125-
});
126-
127-
tape( 'the function throws an error if provided an invalid options argument', function test( t ) {
128-
var values;
129-
var i;
130-
131-
values = [
132-
'5',
133-
5,
134-
NaN,
135-
true,
136-
false,
137-
null,
138-
void 0,
139-
[],
140-
function noop() {},
141-
/.*/,
142-
new Date()
143-
];
144-
145-
for ( i = 0; i < values.length; i++ ) {
146-
t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] );
147-
}
148-
t.end();
149-
150-
function badValue( value ) {
151-
return function badValue() {
152-
countBy( [ 1, 2, 3 ], value, noop );
153-
};
154-
}
155-
});
156-
157-
tape( 'the function groups collection elements according to an indicator function and returns group counts', function test( t ) {
158-
var expected;
159-
var out;
160-
var arr;
161-
162-
function indicator( v ) {
163-
return v[ 0 ];
164-
}
165-
166-
arr = [ 'beep', 'boop', 'foo', 'bar' ];
167-
168-
expected = {
169-
'b': 3,
170-
'f': 1
171-
};
172-
out = countBy( arr, indicator );
173-
174-
t.deepEqual( out, expected, 'returns expected results' );
175-
t.end();
176-
});
177-
178-
tape( 'the function groups collection elements according to an indicator function and returns group counts (typed array)', function test( t ) {
179-
var expected;
180-
var out;
181-
var arr;
182-
183-
function indicator( v ) {
184-
return v;
185-
}
186-
187-
arr = new Float64Array( [ 0, 1, 1, 0 ] );
188-
189-
expected = {
190-
'0': 2,
191-
'1': 2
192-
};
193-
out = countBy( arr, indicator );
194-
195-
t.deepEqual( out, expected, 'returns expected results' );
196-
t.end();
197-
});
198-
199-
tape( 'the function groups collection elements according to an indicator function and returns group counts (array-like object)', function test( t ) {
200-
var expected;
201-
var out;
202-
var arr;
203-
204-
function indicator( v ) {
205-
return v[ 0 ];
206-
}
207-
208-
arr = {
209-
'length': 4,
210-
'0': 'beep',
211-
'1': 'boop',
212-
'2': 'foo',
213-
'3': 'bar'
214-
};
215-
expected = {
216-
'b': 3,
217-
'f': 1
218-
};
219-
out = countBy( arr, indicator );
220-
221-
t.deepEqual( out, expected, 'returns expected results' );
222-
t.end();
223-
});
224-
225-
tape( 'the function groups collection elements according to an indicator function and returns group counts (string serialization)', function test( t ) {
226-
var expected;
227-
var out;
228-
var arr;
229-
230-
function indicator() {
231-
return {};
232-
}
233-
234-
arr = [ 'beep', 'boop', 'foo', 'bar' ];
235-
236-
expected = {
237-
'[object Object]': 4
238-
};
239-
out = countBy( arr, indicator );
240-
241-
t.deepEqual( out, expected, 'returns expected results' );
242-
t.end();
243-
});
244-
245-
tape( 'the function groups collection elements according to an indicator function and returns group counts (string serialization)', function test( t ) {
246-
var expected;
247-
var out;
248-
var arr;
249-
250-
function indicator() {}
251-
252-
arr = [ 'beep', 'boop', 'foo', 'bar' ];
253-
254-
expected = {
255-
'undefined': 4
256-
};
257-
out = countBy( arr, indicator );
258-
259-
t.deepEqual( out, expected, 'returns expected results' );
260-
t.end();
261-
});
262-
263-
tape( 'the function supports providing an execution context', function test( t ) {
264-
var expected;
265-
var opts;
266-
var ctx;
267-
var out;
268-
var arr;
269-
270-
function indicator( v ) {
271-
return v * this.scalar; // eslint-disable-line no-invalid-this
272-
}
273-
274-
ctx = {
275-
'scalar': 2
276-
};
277-
278-
arr = [ 0, 1, 1, 0 ];
279-
280-
opts = {
281-
'thisArg': ctx
282-
};
283-
expected = {
284-
'0': 2,
285-
'2': 2
286-
};
287-
out = countBy( arr, opts, indicator );
288-
289-
t.deepEqual( out, expected, 'returns expected results' );
290-
t.end();
291-
});
292-
293-
tape( 'the function invokes the indicator function with both the collection element and the element index', function test( t ) {
294-
var expected;
295-
var out;
296-
var arr;
297-
298-
function indicator( v, i ) {
299-
return v * i;
300-
}
301-
302-
arr = [ 2, 2, 2, 2 ];
303-
304-
expected = {
305-
'0': 1,
306-
'2': 1,
307-
'4': 1,
308-
'6': 1
309-
};
310-
out = countBy( arr, indicator );
311-
312-
t.deepEqual( out, expected, 'returns expected results' );
313-
t.end();
314-
});
315-
316-
tape( 'if provided an empty collection, the function returns an empty object', function test( t ) {
317-
var expected;
318-
var out;
319-
var arr;
320-
321-
function indicator( v ) {
322-
return v[ 0 ];
323-
}
324-
325-
arr = [];
326-
327-
expected = {};
328-
out = countBy( arr, indicator );
329-
330-
t.deepEqual( out, expected, 'returns expected results' );
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
33132
t.end();
33233
});

0 commit comments

Comments
 (0)