fast-printf
Advanced tools
Comparing version 1.6.5 to 1.6.6
@@ -60,3 +60,3 @@ "use strict"; | ||
} | ||
else if (token.conversion === 'd') { | ||
else if (token.conversion === 'i' || token.conversion === 'd') { | ||
boundValue = String(Math.trunc(boundValue)); | ||
@@ -86,5 +86,2 @@ if (token.width !== null) { | ||
} | ||
else if (token.conversion === 'i') { | ||
result += boundValue; | ||
} | ||
else if (token.conversion === 'o') { | ||
@@ -91,0 +88,0 @@ result += (Number.parseInt(String(boundValue), 10) >>> 0).toString(8); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tokenize = void 0; | ||
const TokenRule = /(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-fosux]))|(\\%)/g; | ||
const TokenRule = /(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g; | ||
const tokenize = (subject) => { | ||
@@ -6,0 +6,0 @@ let matchResult; |
@@ -27,2 +27,8 @@ "use strict"; | ||
}); | ||
ava_1.default('interpolates %i', (t) => { | ||
t.is(printf_1.printf('%i', 123), '123'); | ||
}); | ||
ava_1.default('interpolates %i (removes fractional digits)', (t) => { | ||
t.is(printf_1.printf('%i', 123.567), '123'); | ||
}); | ||
ava_1.default('interpolates %d', (t) => { | ||
@@ -103,5 +109,2 @@ t.is(printf_1.printf('%d', 123), '123'); | ||
}); | ||
ava_1.default('interpolates %i', (t) => { | ||
t.is(printf_1.printf('%f', 123), '123'); | ||
}); | ||
ava_1.default('interpolates %o', (t) => { | ||
@@ -108,0 +111,0 @@ t.is(printf_1.printf('%o', 8), '10'); |
@@ -64,3 +64,3 @@ { | ||
"typings": "./dist/src/printf.d.ts", | ||
"version": "1.6.5" | ||
"version": "1.6.6" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27062