Skip to content

Commit

Permalink
Reduce npm package size
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 2, 2022
1 parent 4cdc213 commit 5bf5c69
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
34 changes: 13 additions & 21 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"filter-obj": "^5.1.0",
"jest-validate": "^29.0.1",
"map-obj": "^5.0.2",
"moize": "^6.1.1",
"mem": "^9.0.2",
"semver": "^7.3.7"
},
"devDependencies": {
Expand Down
6 changes: 2 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'process'

import moize from 'moize'
import mem from 'mem'

import { EVENTS } from './handle/main.js'
import { emitLimitedWarning } from './limit.js'
Expand Down Expand Up @@ -33,9 +33,7 @@ const addListener = function ({ opts, name, eventFunc }) {
// by `removeListener()`, i.e. once `eventListener` is garbage collected.
const previousEvents = new Set()
// Should only emit the warning once per event name and per `init()`
const mEmitLimitedWarning = moize(emitLimitedWarning, {
maxSize: Number.POSITIVE_INFINITY,
})
const mEmitLimitedWarning = mem(emitLimitedWarning)

const eventListener = eventFunc.bind(undefined, {
opts,
Expand Down

0 comments on commit 5bf5c69

Please sign in to comment.