Skip to content

Commit

Permalink
fix(console): filter function support
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jan 27, 2023
1 parent 3550a02 commit 2b6f766
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/Console/Console.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Tool from '../DevTools/Tool'
import noop from 'licia/noop'
import $ from 'licia/$'
import toStr from 'licia/toStr'
import isFn from 'licia/isFn'
import Emitter from 'licia/Emitter'
import isStr from 'licia/isStr'
import isRegExp from 'licia/isRegExp'
import uncaught from 'licia/uncaught'
import trim from 'licia/trim'
import upperFirst from 'licia/upperFirst'
Expand Down Expand Up @@ -91,8 +95,16 @@ export default class Console extends Tool {
const $filterText = this._$filterText
const logger = this._logger

$filterText.text(filter)
logger.setOption('filter', trim(filter))
if (isStr(filter)) {
$filterText.text(filter)
logger.setOption('filter', trim(filter))
} else if (isRegExp(filter)) {
$filterText.text(toStr(filter))
logger.setOption('filter', filter)
} else if (isFn(filter)) {
$filterText.text('ƒ')
logger.setOption('filter', filter)
}
}
destroy() {
this._logger.destroy()
Expand Down
4 changes: 3 additions & 1 deletion src/index.js

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

0 comments on commit 2b6f766

Please sign in to comment.