1.1.2 • Published 2 years ago

babel-plugin-pretty-console v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Install

npm install babel-plugin-pretty-console -D

Usage

Configure PrettyConsole to your .babelrc file.

{
  "plugins": ["pretty-console"]
}

Examples

// #
function add(a, b) {
  return a + b;
}

// equals:

function add(a, b) {
  console.log('add:a', a)
  console.log('add:b', b)
  return a + b;
}
// #warn
let a = add(1, 2)

// equals:

let a = add(1, 2)
console.warn(a)
// #error TestFunction
let add = (a, b) => a + b

// equals:

let add = (a, b) => {
  console.error('TestFunction:a', a)
  console.error('TestFunction:b', b)
  return a + b
}

Plugin options

  • token Set hook token used in comments
  • open Set plugin enabled status
  • printFileName Set print filename to console.log

Comments hook options

// token[consoleType] [hookName]

// ex:
// #warn TestFunction
1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago