console-substitute

0.1.2 • Public • Published

console-substitute

npm GitHub issues dependencies license

Polyfill for the String Substitutions by console.

The console of web browser supports the String Substitutions. It is very useful for debugging, etc.
For example, the multiple variables don't have to be joined by +:

console.info('userName: %s, index: %i', userName, index);

Output:

userName: foo, index: 123

But some browsers such as Android browser, etc. don't support it. A big problem is that all arguments except a first argument (i.e. important informations more than first one) are ignored.
This polyfill implements the String Substitutions to the console that does not support it. This does nothing if the console already supports it.

Usage

<script src="console-substitute.min"></script>

Methods

The following methods support the String Substitutions:

  • console.log
  • console.info
  • console.error
  • console.warn

Substitution Strings

The following substitution strings are supported:

  • %o
  • %d
  • %i
  • %s
  • %f

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i console-substitute

      Weekly Downloads

      4

      Version

      0.1.2

      License

      MIT

      Unpacked Size

      5.05 kB

      Total Files

      5

      Last publish

      Collaborators

      • anseki