Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

format

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

50

package.json

@@ -1,22 +0,30 @@

{ "name" : "format"
, "description" : "printf, sprintf, and vsprintf for JavaScript"
, "version" : "0.1.2"
, "homepage" : "http://samhuri.net/proj/format"
, "author" : "Sami Samhuri <sami@samhuri.net>"
, "repository" :
{ "type" : "git"
, "url" : "https://github.com/samsonjs/format.git"
}
, "bugs" :
{ "mail" : "sami@samhuri.net"
, "web" : "https://github.com/samsonjs/format/issues"
}
, "directories" : { "lib" : "./lib" }
, "main" : "./lib/index"
, "engines" : { "node" : "0.4.x || 0.5.x" }
, "licenses" :
[ { "type" : "MIT"
, "url" : "http://github.com/samsonjs/format/raw/master/LICENSE"
{
"name": "format",
"description": "printf, sprintf, and vsprintf for JavaScript",
"version": "0.1.3",
"homepage": "http://samhuri.net/proj/format",
"author": "Sami Samhuri <sami@samhuri.net>",
"repository": {
"type": "git",
"url": "git://github.com/samsonjs/format.git"
},
"bugs": {
"email": "sami@samhuri.net",
"url": "https://github.com/samsonjs/format/issues"
},
"directories": {
"lib": "./lib"
},
"main": "./lib/index",
"engines": {
"node": "0.4.x - 0.6.x"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/samsonjs/format/raw/master/LICENSE"
}
]
}
],
"dependencies": {},
"devDependencies": {}
}

@@ -1,14 +0,13 @@

var sys = require('sys')
, format = require('./format')
var format = require('./lib')
, printf = format.printf
;
format.extendNativeStrings();
sys.puts('Testing printf:');
'hello'.printf();
sys.puts('(expected "hello")');
'hello %s'.printf('sami');
sys.puts('(expected "hello sami")');
'b: %b\nc: %c\nd: %d\nf: %f\no: %o\ns: %s\nx: %x\nX: %X'.printf(42, 65, 42*42, 42*42*42/1000000000, 255, 'sami', 0xfeedface, 0xc0ffee);
sys.puts('(expected "b: 101010\nc: A\nd: 1764\nf: 0.000074\no: 0377\ns: sami\nx: 0xfeedface\nX: 0xC0FFEE")');
sys.puts('(passed if the output looks ok)');
console.log('Testing printf:');
printf('hello');
console.log('(expected "hello")');
printf('hello %s', 'sami');
console.log('(expected "hello sami")');
printf('b: %b\nc: %c\nd: %d\nf: %f\no: %o\ns: %s\nx: %x\nX: %X', 42, 65, 42*42, 42*42*42/1000000000, 255, 'sami', 0xfeedface, 0xc0ffee);
console.log('(expected "b: 101010\nc: A\nd: 1764\nf: 0.000074\no: 0377\ns: sami\nx: 0xfeedface\nX: 0xC0FFEE")');
console.log('(passed if the output looks ok)');

@@ -19,8 +18,8 @@ function assertEqual(a, b) {

sys.puts('Testing format:');
assertEqual('hello'.format(), 'hello');
assertEqual('hello %s'.format('sami'), 'hello sami');
assertEqual('b: %b\nc: %c\nd: %d\nf: %f\no: %o\ns: %s\nx: %x\nX: %X'.format(42, 65, 42*42, 42*42*42/1000000000, 255, 'sami', 0xfeedface, 0xc0ffee), "b: 101010\nc: A\nd: 1764\nf: 0.000074\no: 0377\ns: sami\nx: 0xfeedface\nX: 0xC0FFEE");
sys.puts('(pass)');
console.log('Testing format:');
assertEqual(format.format('hello'), 'hello');
assertEqual(format.format('hello %s', 'sami'), 'hello sami');
assertEqual(format.format('b: %b\nc: %c\nd: %d\nf: %f\no: %o\ns: %s\nx: %x\nX: %X', 42, 65, 42*42, 42*42*42/1000000000, 255, 'sami', 0xfeedface, 0xc0ffee), "b: 101010\nc: A\nd: 1764\nf: 0.000074\no: 0377\ns: sami\nx: 0xfeedface\nX: 0xC0FFEE");
console.log('(pass)');
sys.puts('all passed');
console.log('all passed');
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc