@uoctamika/libraryjs
Advanced tools
+20
-23
@@ -5,2 +5,5 @@ "use strict"; | ||
| const util_1 = require("util"); | ||
| const VALID_SPECIFIERS = new Set([ | ||
| 's', 'd', 'i', 'f', 'c', 'o', 'O', 'x', 'X', 'b', 'j', '%' | ||
| ]); | ||
| function formatArg(arg, specifier) { | ||
@@ -24,32 +27,26 @@ switch (specifier) { | ||
| function printf(format, ...args) { | ||
| let output = ''; | ||
| const parts = []; | ||
| let argIndex = 0; | ||
| let i = 0; | ||
| const len = format.length; | ||
| const validSpecifiers = ['s', 'd', 'i', 'f', 'c', 'o', 'O', 'x', 'X', 'b', 'j', '%']; | ||
| while (i < len) { | ||
| if (format[i] === '%') { | ||
| if (i + 1 < len) { | ||
| const spec = format[i + 1]; | ||
| if (spec === '%') { | ||
| output += '%'; | ||
| i += 2; | ||
| continue; | ||
| } | ||
| if (validSpecifiers.includes(spec)) { | ||
| const value = args[argIndex++]; | ||
| output += formatArg(value, spec); | ||
| i += 2; | ||
| continue; | ||
| } | ||
| const ch = format[i]; | ||
| if (ch === '%' && i + 1 < len) { | ||
| const spec = format[i + 1]; | ||
| if (spec === '%') { | ||
| parts.push('%'); | ||
| i += 2; | ||
| continue; | ||
| } | ||
| output += format[i]; | ||
| i++; | ||
| if (VALID_SPECIFIERS.has(spec)) { | ||
| const value = args[argIndex++]; | ||
| parts.push(formatArg(value, spec)); | ||
| i += 2; | ||
| continue; | ||
| } | ||
| } | ||
| else { | ||
| output += format[i]; | ||
| i++; | ||
| } | ||
| parts.push(ch); | ||
| i++; | ||
| } | ||
| process.stdout.write(output); | ||
| process.stdout.write(parts.join('')); | ||
| } |
| import { inspect } from 'util'; | ||
| const VALID_SPECIFIERS = new Set([ | ||
| 's', 'd', 'i', 'f', 'c', 'o', 'O', 'x', 'X', 'b', 'j', '%' | ||
| ]); | ||
| function formatArg(arg, specifier) { | ||
@@ -20,32 +23,26 @@ switch (specifier) { | ||
| export function printf(format, ...args) { | ||
| let output = ''; | ||
| const parts = []; | ||
| let argIndex = 0; | ||
| let i = 0; | ||
| const len = format.length; | ||
| const validSpecifiers = ['s', 'd', 'i', 'f', 'c', 'o', 'O', 'x', 'X', 'b', 'j', '%']; | ||
| while (i < len) { | ||
| if (format[i] === '%') { | ||
| if (i + 1 < len) { | ||
| const spec = format[i + 1]; | ||
| if (spec === '%') { | ||
| output += '%'; | ||
| i += 2; | ||
| continue; | ||
| } | ||
| if (validSpecifiers.includes(spec)) { | ||
| const value = args[argIndex++]; | ||
| output += formatArg(value, spec); | ||
| i += 2; | ||
| continue; | ||
| } | ||
| const ch = format[i]; | ||
| if (ch === '%' && i + 1 < len) { | ||
| const spec = format[i + 1]; | ||
| if (spec === '%') { | ||
| parts.push('%'); | ||
| i += 2; | ||
| continue; | ||
| } | ||
| output += format[i]; | ||
| i++; | ||
| if (VALID_SPECIFIERS.has(spec)) { | ||
| const value = args[argIndex++]; | ||
| parts.push(formatArg(value, spec)); | ||
| i += 2; | ||
| continue; | ||
| } | ||
| } | ||
| else { | ||
| output += format[i]; | ||
| i++; | ||
| } | ||
| parts.push(ch); | ||
| i++; | ||
| } | ||
| process.stdout.write(output); | ||
| process.stdout.write(parts.join('')); | ||
| } |
+4
-10
| { | ||
| "name": "@uoctamika/libraryjs", | ||
| "version": "1.1.2", | ||
| "version": "1.1.3", | ||
| "description": " A lightweight JavaScript & TypeScript utility library - just import and use. No configuration needed, functions are ready to use", | ||
@@ -19,10 +19,7 @@ "main": "./dist/cjs/index.js", | ||
| "scripts": { | ||
| "build": "npm run clean && npm run build:cjs && npm run build:esm", | ||
| "build": "npm run clean && npm run build:cjs && npm run build:esm && npm run rename:mjs", | ||
| "build:cjs": "tsc -p tsconfig.json", | ||
| "build:esm": "tsc -p tsconfig.esm.json && npm run rename:mjs", | ||
| "build:esm": "tsc -p tsconfig.esm.json", | ||
| "rename:mjs": "find dist/esm -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\; && find dist/esm -name '*.mjs' -exec sed -i \"s/from '\\\\(.*\\\\)\\\\.js'/from '\\\\1.mjs'/g\" {} \\;", | ||
| "clean": "rm -rf dist", | ||
| "test": "echo \"Error: no test specified\" && exit 1", | ||
| "lint": "eslint src --ext .ts", | ||
| "format": "prettier --write \"src/**/*.ts\"" | ||
| "clean": "rm -rf dist" | ||
| }, | ||
@@ -57,5 +54,2 @@ "repository": { | ||
| "@types/node": "^25.9.1", | ||
| "@typescript-eslint/eslint-plugin": "^8.60.0", | ||
| "@typescript-eslint/parser": "^8.60.0", | ||
| "eslint": "^10.4.1", | ||
| "prettier": "^3.8.3", | ||
@@ -62,0 +56,0 @@ "typescript": "^6.0.3" |
+1
-1
@@ -54,3 +54,3 @@ # libraryjs | ||
| <br> | ||
| const {stdio } = require('@uoctamika/libraryjs'); | ||
@@ -57,0 +57,0 @@ stdio.printf(format: string, ...args: any[]): void; |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
3
-50%0
-100%13067
-3.43%157
-3.68%