Skip to content

Commit

Permalink
feat: drop eval
Browse files Browse the repository at this point in the history
  • Loading branch information
onhate committed Aug 7, 2024
1 parent c214667 commit 1d01950
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inbatches",
"version": "0.0.10",
"version": "0.0.11",
"private": false,
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"package.json"
],
"devDependencies": {
"@types/jest": "^29.5.5",
"@types/jest": "^29.5.10",
"jest": "^29.7.0",
"ts-jest": "^29.1.1"
}
Expand Down
9 changes: 6 additions & 3 deletions src/batcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ class Batch<K, V> {
}
}

const isomorphicNextTick =
typeof window !== 'undefined' && window.document
const isBrowser = typeof window !== 'undefined' && !!window.document;
const isNode = typeof process !== 'undefined' && !!process.nextTick;
const isomorphicNextTick = isNode
? process.nextTick
: isBrowser
? typeof setImmediate !== 'undefined'
? setImmediate
: setTimeout
: eval('process.nextTick');
: undefined

const defaultOptions: BatcherOptions = { maxBatchSize: 25 };

Expand Down

0 comments on commit 1d01950

Please sign in to comment.