Skip to content

Commit 76081d8

Browse files
fixed bugs
1 parent be6f78c commit 76081d8

5 files changed

Lines changed: 10 additions & 215 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## [v2.0.5](https://github.com/jsvibe/printfy/compare/v2.0.4...v2.0.5) - 23 August 2025
4+
5+
- Fixed bugs likes `padding`, `width`, `precision`, `swapping` etc. to improved better than previous version [2.0.4] [@indianmodassir](https://github.com/indianmodassir)
6+
37
## [v2.0.4](https://github.com/jsvibe/printfy/compare/v2.0.3...v2.0.4) - 22 August 2025
48

59
- Removed local minified version now available only minified version on jsDelivr CDN. [@indianmodassir](https://github.com/indianmodassir)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Below are some of the most common ways to include printfy.
6161
**CDN Link**
6262

6363
```html
64-
<script src="https://cdn.jsdelivr.net/npm/printfy@2.0.4/dist/printfy.min.js"></script>
64+
<script src="https://cdn.jsdelivr.net/npm/printfy@2.0.5/dist/printfy.min.js"></script>
6565
```
6666

6767
You can add the script manually to your project:

lib/printfy.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ function doAdjust(value, padding, flag, width, precision, isStr) {
215215

216216
// Applies padding and alignment to the value.
217217
function setPadding(value, padding, flag, width, isNumeric) {
218-
var rFlag = /^[+-]/;
219-
var valueSign = rFlag.exec(value);
220218
var setFlag = function(flag, value, padding = '') {
219+
var rFlag = /^[+-]/, valueSign = rFlag.exec(value);
220+
221221
value = value.replace(rFlag, '');
222222

223223
// Remove padding by one character if valueSign doesn't match
@@ -229,16 +229,6 @@ function setPadding(value, padding, flag, width, isNumeric) {
229229
return padding[0] === '0' ? flag + padding + value : padding + flag + value;
230230
};
231231

232-
// Remove Math sign [+-] from value
233-
if (isNumeric) {
234-
value = value.replace(rFlag, '');
235-
}
236-
237-
// Add flag sign [+-] in processed value
238-
if (valueSign) {
239-
value = valueSign[0] + value;
240-
}
241-
242232
// Remove leading single quote from padding character if present
243233
// And remove leading [.char] from padding character if present
244234
padding = padding.replace(/^'(?:\.(.))?/g, "$1") || "\x20";

package-lock.json

Lines changed: 2 additions & 201 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "printfy",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "C-style printf formatting for JavaScript with padding and precision.",
55
"main": "lib/printfy.js",
66
"scripts": {

0 commit comments

Comments
 (0)