How to use sprintf - 10 common examples

To help you get started, we’ve selected a few sprintf 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 Phrogz / context-blender / test / run_tests.js View on Github external
function writeResults(results){
	var lines = [];
	for (var i=0;i3 });
			var percent = 100 * wrongs.length / Math.pow(140,2);
			var delta   = wrongs.sum();
			lines.push( sprintf("%-12s   wrong:%3d%%   delta:%8d   time:%5.1fms", result.mode, percent, delta, result.time ) );
		}
	}
	fs.writeFileSync(__dirname+'/results.txt',lines.join("\n"));
}
github cloudkick / cast / tests / simple / test-deployment.js View on Github external
function(callback) {
      if (!verifyServiceExists) {
        callback();
        return;
      }

      var serviceName = sprintf('%s@%s', name, version);
      fs.stat(path.join(svcRootAvail, serviceName), function(err, stats) {
        assert.ifError(err);
        assert.ok(stats.isDirectory());
        callback();
      });
    }
  ],
github danielwippermann / resol-vbus / tools / specification-importer / cleanup.js View on Github external
var formatFieldId = function(field) {
	var firstField = field.fields [0] || field;
	var size = Math.ceil(firstField.bitSize / 8);
	var mask;
	if (firstField.bitSize === 1) {
		mask = (1 << firstField.bitPos);
	} else {
		mask = 0;
	}
    return sprintf('%03d_%d_%d', firstField.offset, size, mask);
};
github cloudkick / cast / lib / util / spinner.js View on Github external
PercentBarSpinner.prototype.tick = function(value) {
  this.current = value;
  var bar = this.barstr();
  var val = this.percent();
  this.update(sprintf(' %4d%%', val) + ' [' + this.barstr() + '] ');
};
github Azure / node-red-contrib-azure / sql / node_modules / tedious / lib / login7-payload.js View on Github external
value: function toString(indent) {
      indent || (indent = '');
      return indent + 'Login7 - ' + sprintf('TDS:0x%08X, PacketSize:0x%08X, ClientProgVer:0x%08X, ClientPID:0x%08X, ConnectionID:0x%08X', this.tdsVersion, this.packetSize, this.clientProgVer, this.clientPid, this.connectionId) + '\n' + indent + '         ' + sprintf('Flags1:0x%02X, Flags2:0x%02X, TypeFlags:0x%02X, Flags3:0x%02X, ClientTimezone:%d, ClientLCID:0x%08X', this.flags1, this.flags2, this.typeFlags, this.flags3, this.clientTimeZone, this.clientLcid) + '\n' + indent + '         ' + sprintf("Hostname:'%s', Username:'%s', Password:'%s', AppName:'%s', ServerName:'%s', LibraryName:'%s'", this.hostname, this.loginData.userName, this.loginData.password, this.loginData.appName, this.loginData.serverName, libraryName) + '\n' + indent + '         ' + sprintf("Language:'%s', Database:'%s', SSPI:'%s', AttachDbFile:'%s', ChangePassword:'%s'", this.loginData.language, this.loginData.database, this.sspi, this.attachDbFile, this.changePassword);
    }
  }]);
github Kami / node-bittorrent-tracker / lib / services / http-tracker.js View on Github external
this._server.listen(conf['port'], conf['ip'], function onBound() {
    self._running = true;
    self._log.info(sprintf('Tracker started and listening at %s://%s:%s',
                     protocol, conf['ip'], conf['port']));
    callback();
  });
};
github nuxeo / nuxeo / rest-api / nuxeo-rest-api-server / src / main / resources / skin / resources / lib / shred.bundle.nx.js View on Github external
get: function() {
      if (!this.scheme) { return null; }
      return sprintf("%s://%s:%s%s",
          this.scheme, this.host, this.port,
          (this.proxy ? "/" : this.path) +
          (this.query ? ("?" + this.query) : ""));
    },
    set: function(_url) {
github GreenButtonAlliance / OpenESPI-GreenButton-API-Documentation / API / lib / shred.bundle.js View on Github external
get: function() {
      if (!this.scheme) { return null; }
      return sprintf("%s://%s:%s%s",
          this.scheme, this.host, this.port,
          (this.proxy ? "/" : this.path) +
          (this.query ? ("?" + this.query) : ""));
    },
    set: function(_url) {
github swagger-api / swagger-ui / lib / shred.bundle.js View on Github external
get: function() {
      if (!this.scheme) { return null; }
      return sprintf("%s://%s:%s%s",
          this.scheme, this.host, this.port,
          (this.proxy ? "/" : this.path) +
          (this.query ? ("?" + this.query) : ""));
    },
    set: function(_url) {
github cloudkick / cast / lib / cast-client / commands / deploy.js View on Github external
function upgradeInstance(callback) {
    var args = {
      'remote': remote,
      'name': instanceName,
      'version': version
    };

    successMsg = sprintf('Application %s %s has been successfully ' +
         'deployed (instance %s has been upgraded to v%s). If the ' +
         'application did not start properly, you can use the ' +
         'following command to view it\'s log file: ' +
         'cast services tail %s', applicationName, version, instanceName,
                                  version);
    instancesUpgradeCmd(args, parser, callback);
  }

sprintf

Sprintf() for node.js

BSD-3-Clause
Latest version published 10 years ago

Package Health Score

53 / 100
Full package analysis

Popular sprintf functions

Similar packages