Skip to content

Commit 8be27ec

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 3cb6fe5 + f4024f0 commit 8be27ec

File tree

606 files changed

+68916
-3070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

606 files changed

+68916
-3070
lines changed

docs/migration-guides/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2023 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
121
# Migration Guides
222

323
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

docs/migration-guides/async/.npmrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2023 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Configuration for [npm][1].
20+
#
21+
# [1]: https://docs.npmjs.com/files/npmrc
22+
23+
# Disable the creation of a lock file:
24+
package-lock = false
25+
shrinkwrap = false
26+
27+
# Disable automatically "saving" dependencies on install:
28+
save = false

docs/migration-guides/async/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2023 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
121
# Async
222

323
> Migration guide for async.js.

docs/migration-guides/jstat/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2023 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
121
# jStat
222

323
> Migration guide for jStat.

docs/migration-guides/jstat/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
1515
}
1616
],
17-
"main": "./benchmark/benchmark.js",
17+
"main": "./package.json",
1818
"directories": {
1919
"benchmark": "./benchmark"
2020
},
@@ -31,10 +31,7 @@
3131
"jstat": "^1.9.3"
3232
},
3333
"devDependencies": {},
34-
"engines": {
35-
"node": ">=0.10.0",
36-
"npm": ">2.7.0"
37-
},
34+
"engines": {},
3835
"os": [
3936
"aix",
4037
"darwin",

docs/migration-guides/lodash/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2023 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
121
# Lodash
222

323
> Migration guide for Lodash.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var resolve = require( 'path' ).resolve;
24+
var bench = require( '@stdlib/bench' );
25+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
26+
var tryRequire = require( '@stdlib/utils/try-require' );
27+
var countBy = require( '@stdlib/utils/count-by' );
28+
var pkg = require( './../package.json' ).name;
29+
30+
31+
// VARIABLES //
32+
33+
var _ = tryRequire( resolve( __dirname, '..', 'node_modules', 'lodash' ) );
34+
var opts = {
35+
'skip': ( _ instanceof Error )
36+
};
37+
38+
39+
// MAIN //
40+
41+
bench( pkg+'::stdlib:utils/count-by', opts, function benchmark( b ) {
42+
var vals;
43+
var arr;
44+
var o;
45+
var i;
46+
var j;
47+
48+
vals = [ 'beep', 'boop', 'foo', 'bar', 'woot' ];
49+
50+
arr = [];
51+
for ( i = 0; i < 100; i++ ) {
52+
j = discreteUniform( 0, vals.length-1 );
53+
arr.push( vals[ j ] );
54+
}
55+
b.tic();
56+
for ( i = 0; i < b.iterations; i++ ) {
57+
arr[ 0 ] = vals[ i%vals.length ];
58+
o = countBy( arr, indicator );
59+
if ( typeof o !== 'object' ) {
60+
b.fail( 'should return an object' );
61+
}
62+
}
63+
b.toc();
64+
if ( typeof o !== 'object' ) {
65+
b.fail( 'should return an object' );
66+
}
67+
b.pass( 'benchmark finished' );
68+
b.end();
69+
70+
function indicator( v ) {
71+
return v[ 0 ];
72+
}
73+
});
74+
75+
bench( pkg+'::lodash:countBy', opts, function benchmark( b ) {
76+
var vals;
77+
var arr;
78+
var o;
79+
var i;
80+
var j;
81+
82+
vals = [ 'beep', 'boop', 'foo', 'bar', 'woot' ];
83+
84+
arr = [];
85+
for ( i = 0; i < 100; i++ ) {
86+
j = discreteUniform( 0, vals.length-1 );
87+
arr.push( vals[ j ] );
88+
}
89+
b.tic();
90+
for ( i = 0; i < b.iterations; i++ ) {
91+
arr[ 0 ] = vals[ i%vals.length ];
92+
o = _.countBy( arr, indicator );
93+
if ( typeof o !== 'object' ) {
94+
b.fail( 'should return an object' );
95+
}
96+
}
97+
b.toc();
98+
if ( typeof o !== 'object' ) {
99+
b.fail( 'should return an object' );
100+
}
101+
b.pass( 'benchmark finished' );
102+
b.end();
103+
104+
function indicator( v ) {
105+
return v[ 0 ];
106+
}
107+
});
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var resolve = require( 'path' ).resolve;
24+
var bench = require( '@stdlib/bench' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
27+
var tryRequire = require( '@stdlib/utils/try-require' );
28+
var every = require( '@stdlib/utils/every' );
29+
var pkg = require( './../package.json' ).name;
30+
31+
32+
// VARIABLES //
33+
34+
var _ = tryRequire( resolve( __dirname, '..', 'node_modules', 'lodash' ) );
35+
var opts = {
36+
'skip': ( _ instanceof Error )
37+
};
38+
39+
40+
// MAIN //
41+
42+
bench( pkg+'::stdlib:utils/every', opts, function benchmark( b ) {
43+
var bool;
44+
var arr;
45+
var i;
46+
47+
arr = [ 1, 2, 3, 4, 5 ];
48+
49+
b.tic();
50+
for ( i = 0; i < b.iterations; i++ ) {
51+
arr[ 0 ] += i;
52+
bool = every( arr, predicate );
53+
if ( typeof bool !== 'boolean' ) {
54+
b.fail( 'should return a boolean' );
55+
}
56+
}
57+
b.toc();
58+
if ( !isBoolean( bool ) ) {
59+
b.fail( 'should return a boolean' );
60+
}
61+
b.pass( 'benchmark finished' );
62+
b.end();
63+
64+
function predicate( v ) {
65+
return !isnan( v );
66+
}
67+
});
68+
69+
bench( pkg+'::lodash:every', opts, function benchmark( b ) {
70+
var bool;
71+
var arr;
72+
var i;
73+
74+
arr = [ 1, 2, 3, 4, 5 ];
75+
76+
b.tic();
77+
for ( i = 0; i < b.iterations; i++ ) {
78+
arr[ 0 ] += i;
79+
bool = _.every( arr, predicate );
80+
if ( typeof bool !== 'boolean' ) {
81+
b.fail( 'should return a boolean' );
82+
}
83+
}
84+
b.toc();
85+
if ( !isBoolean( bool ) ) {
86+
b.fail( 'should return a boolean' );
87+
}
88+
b.pass( 'benchmark finished' );
89+
b.end();
90+
91+
function predicate( v ) {
92+
return !isnan( v );
93+
}
94+
});

0 commit comments

Comments
 (0)