Compare commits

...

4 Commits
0.3.1 ... 0.3.4

Author SHA1 Message Date
d4bd054953 Made pad function a little easier to use
All checks were successful
Build / Build NPM Project (push) Successful in 31s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 14s
2024-02-29 10:30:48 -05:00
cf9bdca2ba Made pad function a little easier to use
All checks were successful
Build / Build NPM Project (push) Successful in 32s
Build / Tag Version (push) Successful in 8s
Build / Publish (push) Successful in 18s
2024-02-29 10:26:56 -05:00
0e2d720fdf Made pad function a little easier to use
Some checks failed
Build / Tag Version (push) Blocked by required conditions
Build / Publish (push) Blocked by required conditions
Build / Build NPM Project (push) Has been cancelled
2024-02-29 10:26:49 -05:00
061e27d92a Fixed build
All checks were successful
Build / Build NPM Project (push) Successful in 32s
Build / Tag Version (push) Successful in 7s
Build / Publish (push) Successful in 17s
2024-02-28 23:57:20 -05:00
4 changed files with 14 additions and 10 deletions

View File

@ -25,6 +25,9 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: npm i run: npm i
- name: Build Project
run: npm run build
- name: Test - name: Test
run: npm run test:coverage run: npm run test:coverage

View File

@ -1,6 +1,6 @@
{ {
"name": "@ztimson/js-utilities", "name": "@ztimson/js-utilities",
"version": "0.3.1", "version": "0.3.4",
"description": "JavaScript Utility library", "description": "JavaScript Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",
@ -13,7 +13,6 @@
"module": "./dist/js-utilities.mjs", "module": "./dist/js-utilities.mjs",
"types": "./dist/src/index.d.ts", "types": "./dist/src/index.d.ts",
"scripts": { "scripts": {
"postinstall": "npm run build",
"build": "npx vite build", "build": "npx vite build",
"test": "npx jest", "test": "npx jest",
"test:coverage": "npx jest --coverage", "test:coverage": "npx jest --coverage",

View File

@ -62,11 +62,12 @@ export class Logger extends TypedEmitter<LoggerEvents> {
super(); super();
} }
private pad(text: string, length: number, char: string, end = false) { private pad(text: any, length: number, char: string, end = false) {
const l = length - text.length; const t = text.toString();
if(l <= 0) return text; const l = length - t.length;
if(l <= 0) return t;
const padding = Array(~~(l / char.length)).fill(char).join(''); const padding = Array(~~(l / char.length)).fill(char).join('');
return !end ? padding + text : text + padding; return !end ? padding + t : t + padding;
} }

View File

@ -52,11 +52,12 @@ export function insertAt(target: string, str: string, index: number): String {
return `${target.slice(0, index)}${str}${target.slice(index + 1)}`; return `${target.slice(0, index)}${str}${target.slice(index + 1)}`;
} }
export function pad(text: string, length: number, char: string, start = true) { export function pad(text: any, length: number, char: string, start = true) {
const l = length - text.length; const t = text.toString();
if(l <= 0) return text; const l = length - t.length;
if(l <= 0) return t;
const padding = Array(~~(l / char.length)).fill(char).join(''); const padding = Array(~~(l / char.length)).fill(char).join('');
return start ? padding + text : text + padding; return start ? padding + t : t + padding;
} }
/** /**