How to use the printf.apply function in printf

To help you get started, we’ve selected a few printf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github azukiapp / azk / lib / azk / utils / i18n.js View on Github external
($traceurRuntime.createClass)(i18n, {translate: function(key) {
    for (var args = [],
        $__2 = 1; $__2 < arguments.length; $__2++)
      args[$__2 - 1] = arguments[$__2];
    var keys = (typeof(key) == "string") ? key.split('.') : key;
    var buffer = this.dict || {};
    for (var i = 0; i < keys.length; i++) {
      buffer = buffer[keys[i]];
      if (!buffer)
        break;
    }
    if (buffer) {
      return typeof(buffer) == "string" ? printf.apply(null, $traceurRuntime.spread([buffer], args)) : buffer;
    } else {
      return (typeof(key) == "string" ? key : key.join("."));
    }
  }}, {});
module.exports = {
github clibs / clib / index.js View on Github external
function printf() {
  console.log(sprintf.apply(null, arguments));
}
github hacksalot / HackMyResume / src / cli / out.js View on Github external
log: function( msg ) {
      msg = msg || '';
      var printf = require('printf');
      var finished = printf.apply( printf, arguments );
      this.opts.silent || console.log( finished );
    },
github azukiapp / azk / lib / azk / cli / ui.js View on Github external
output: function(string) {
    for (var args = [],
        $__3 = 1; $__3 < arguments.length; $__3++)
      args[$__3 - 1] = arguments[$__3];
    this.stdout().write(printf.apply(null, $traceurRuntime.spread([string || ""], args)) + "\n");
  },
  tOutput: function() {
github azukiapp / azk / lib / cli / helpers.js View on Github external
return function() {
    var args = _.toArray(arguments);
    if (proto.match(/^table/)) {
      var msg = args;
    } else {
      var msg  = (args[0].match(/%/)) ?
        printf.apply(null, args) : azk.t.apply(null, args)
    }
    notify({ type: proto, msg: msg });
  }
}

printf

Full implementation of the `printf` family in pure JS.

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis