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

printj

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

printj - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "printj",
"version": "0.1.0",
"version": "0.1.1",
"author": "sheetjs",

@@ -5,0 +5,0 @@ "description": "Pure-JS printf",

@@ -27,3 +27,3 @@

PRINTJ.version = '0.1.0';
PRINTJ.version = '0.1.1';

@@ -275,3 +275,3 @@ function tokenize(fmt) {

case /*p*/ 112:
Vnum = typeof arg == "number" ? arg : Number(arg.l);
Vnum = typeof arg == "number" ? arg : arg ? Number(arg.l) : -1;
if(isNaN(Vnum)) Vnum = -1;

@@ -300,3 +300,3 @@ if(alt) O = Vnum.toString(10);

case /*J*/ 74: O = (alt ? u_inspect : JSON.stringify)(arg); break;
case /*V*/ 86: O = String(arg.valueOf()); break;
case /*V*/ 86: O = arg == null ? "null" : String(arg.valueOf()); break;
case /*T*/ 84:

@@ -367,3 +367,3 @@ if(alt) { /* from '[object %s]' extract %s */

case 4: Vnum = sign ? (Vnum | 0) : (Vnum >>> 0); break;
default: Vnum = Math.round(Vnum); break;
default: Vnum = isNaN(Vnum) ? 0 : Math.round(Vnum); break;
}

@@ -447,2 +447,3 @@

Vnum = Number(arg);
if(arg === null) Vnum = 0/0;
if(len == "L") bytes = 12;

@@ -476,3 +477,3 @@ var isf = isFinite(Vnum);

case 1: case 11:
if(Vnum < Math.pow(10,21)) {
if(Vnum < 1e21) {
O = Vnum.toFixed(prec);

@@ -479,0 +480,0 @@ if(isnum == 1) { if(prec===0 &&alt&& O.indexOf(".")==-1) O+="."; }

# printj
Extended `sprintf` implementation (for the browser and nodejs). Emphasis on
compliance and performance.
compliance, performance and IE6+ support.

@@ -18,7 +18,11 @@ ```JS

$ npm install printj
```bash
$ npm install printj
```
In the browser:
<script src="printj.js"></script>
```html
<script src="printj.js"></script>
```

@@ -48,3 +52,3 @@ The browser exposes a variable `PRINTJ`

> // var PRINTJ = require('printj'); // uncomment this line if in node
> var sprintf = PRINTJ.sprintf, vsprintf = PRINTJ.vsprintf;
> var sprintf = PRINTJ.sprintf, vsprintf = PRINTJ.vsprintf;
> sprintf("Hello %s", "SheetJS") // 'Hello SheetJS'

@@ -92,3 +96,3 @@ > sprintf("%d + %d = %d", 2,3,2+3) // '2 + 3 = 5'

## Badges
## Badges

@@ -143,3 +147,3 @@ [![Build Status](https://travis-ci.org/SheetJS/printj.svg?branch=master)](https://travis-ci.org/SheetJS/printj)

ASCII) maps those numbers to characters. K&R defines two types of strings:
basic character set strings (`char *`) and extended character set strings
basic character set strings (`char *`) and extended character set strings
(`wchar_t *`). In contrast, JS has a true string value type.

@@ -446,3 +450,3 @@

| C data type | precision | total bits | exponent | mantissa | fmt |
| C data type | precision | total bits | exponent | mantissa | fmt |
|:--------------|:----------|:----------:|:--------:|:--------:|------:|

@@ -551,3 +555,3 @@ | `float` | single | `32` | `8` | `23` | |

| implied C type | ctypes.json | length | conv default |
| implied C type | ctypes.json | length | conv default |
|:------------------------------------|:------------|:------:|:-------------|

@@ -558,3 +562,3 @@ | `int` or `unsigned int` | `int` | (none) | d i o u x X |

| `long` or `unsigned long` | `long` | l | D U O |
| `long long` or `unsigned long long` | `longlong` | L ll q |
| `long long` or `unsigned long long` | `longlong` | L ll q |
| `intmax_t` or `uintmax_t` | `intmax_t` | j |

@@ -566,5 +570,5 @@ | `size_t` or `ssize_t` | `size_t` | z Z |

`num.toString(10)` produces the correct result for exact integers.
`num.toString(10)` produces the correct result for exact integers.
`"u"` conversion restricts values to `int`; `"U"` restricts to `long`.
`"u"` conversion restricts values to `int`; `"U"` restricts to `long`.

@@ -574,7 +578,7 @@ ## Rendering Unsigned Integers in Base 8 ("o" and "O" conversions)

Even though `num.toString(8)` is implementation-dependent, all browser
implementations use standard form for integers in the exact range.
implementations use standard form for integers in the exact range.
The alternate form (`#`) prints a `"0"` prefix.
`"o"` conversion restricts values to `int`; `"O"` restricts to `long`.
`"o"` conversion restricts values to `int`; `"O"` restricts to `long`.

@@ -584,3 +588,3 @@ ## Rendering Unsigned Integers in Base 16 ("x" and "X" conversions)

Even though `num.toString(16)` is implementation-dependent, all browser
implementations use standard form for integers in the exact range.
implementations use standard form for integers in the exact range.

@@ -596,3 +600,3 @@ The alternate form (`#`) prints a `"0x"` or `"0X"` prefix.

`"di"` conversions restrict values to `int`; `"D"` restricts to `long`.
`"di"` conversions restrict values to `int`; `"D"` restricts to `long`.

@@ -692,3 +696,3 @@

standard hexadecimal form. Chrome, Safari and other browsers always use the
exact standard hexadecimal form. Both forms are easily converted to `"%a"` by
exact standard hexadecimal form. Both forms are easily converted to `"%a"` by
calculating and dividing by the appropriate power of 2.

@@ -710,3 +714,3 @@

fix the result at the end. FreeBSD and OSX always show the normalized form.
This implementation defaults to the normalized form. To switch to the glibc
This implementation defaults to the normalized form. To switch to the glibc
form, define `DO_NOT_NORMALIZE` in the `JSFLAGS` variable when building:

@@ -974,3 +978,3 @@

|:------------------|:--------------|:---------------------------------------|
| `"\a"` | `"\007"` | BEL character will not ring in browser |
| `"\a"` | `"\007"` | BEL character will not ring in browser |
| `"\?"` | `"?"` | JS does not handle trigraphs |

@@ -987,5 +991,5 @@ | `"\ooo"` (octal) | `"\ooo"` | JS uses Latin-1 for non-ASCII codes |

- Parser accepts but does not emulate CRT wide and unicode character conversions
- glibc `Z` length conversion and extended `m` error support
- CRT `I/w` length but no `I32/I64`
- glibc `Z` length conversion and extended `m` error support
- Parser fails on CRT `I32`/`I64` fixed lengths
- Default `LP64` data model but can be configured to support `ILP32` or `LLP64`
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