Skip to content

Commit f11172e

Browse files
committed
feat: add underscore benchmark
1 parent bde779f commit f11172e

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ packages operations.
1616
- [x] winston
1717
- [ ] helmet
1818
- [ ] node-sass
19-
- [ ] underscore
19+
- [x] underscore
2020
- [ ] minify

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"pino": "8.19.0",
99
"piscina": "4.4.0",
1010
"prettier": "3.2.5",
11+
"underscore": "1.13.6",
1112
"winston": "3.12.0"
1213
},
1314
"devDependencies": {

pnpm-lock.yaml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/underscore-benchmark.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const underscore = require('underscore');
2+
3+
module.exports = {
4+
name: 'underscore',
5+
type: 'operation',
6+
operations: [
7+
{
8+
name: '.chunk',
9+
fn: () => {
10+
underscore.chunk(['a', 'b', 'c', 'd'], 2);
11+
},
12+
},
13+
{
14+
name: '.groupBy',
15+
fn: () => {
16+
underscore.groupBy([6.1, 4.2, 6.3], Math.floor);
17+
},
18+
},
19+
{
20+
name: '.includes',
21+
fn: () => {
22+
underscore.includes({ 'a': 1, 'b': 2 }, 1);
23+
},
24+
},
25+
{
26+
name: '.orderBy',
27+
fn: () => {
28+
const users = [
29+
{ 'user': 'fred', 'age': 48 },
30+
{ 'user': 'barney', 'age': 34 },
31+
{ 'user': 'fred', 'age': 40 },
32+
{ 'user': 'barney', 'age': 36 }
33+
];
34+
underscore.sortBy(users, ['user', 'age'], ['asc', 'desc']);
35+
}
36+
}
37+
],
38+
benchmarker: 'benchmarkjs',
39+
};

0 commit comments

Comments
 (0)