regexp.js 316 B

12345678
  1. import { truncate } from './helpers'
  2. export default function inspectRegExp(value, options) {
  3. const flags = value.toString().split('/')[2]
  4. const sourceLength = options.truncate - (2 + flags.length)
  5. const source = value.source
  6. return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, 'regexp')
  7. }