Skip to content

Commit 78ea0ba

Browse files
committed
feat(utils): randomString & isObjectEmpty functions utils
1 parent df20991 commit 78ea0ba

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
run: npm run build
2626

2727
- name: Releae
28+
if: success()
2829
run: npm run release
2930
env:
3031
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './utils';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Generate a random, unique string
3+
*/
4+
export function randomString(from = 10, to = 5): string {
5+
return btoa(String(Math.random())).substr(from, to).toLowerCase();
6+
}
7+
8+
/**
9+
* Check if it's an object and it's not empty
10+
*/
11+
export function isObjectEmpty(obj: object | null): boolean {
12+
return !Boolean(obj) || Object.keys(obj).length === 0 && obj.constructor === Object;
13+
}

0 commit comments

Comments
 (0)