Skip to content

Commit abb2920

Browse files
committed
Update index.js improved Object.isEmpty and added Array.isEmpty
1 parent dd9083d commit abb2920

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ if (!existsSync('./src/urlList.js')) copyFileSync('./src/urlList.example', './sr
55
import { urlList, options, execOptions } from './src/urlList.js'
66

77
Object.prototype.isEmpty = (obj) => {
8-
for (const prop in obj) {
9-
if (Object.hasOwn(obj, prop)) {
10-
return false;
11-
}
12-
}
8+
for (const prop in obj)
9+
if (Object.hasOwn(obj, prop)) return false
1310

14-
return true;
11+
return true
12+
}
13+
14+
Array.prototype.isEmpty = (arr) => {
15+
if (arr === undefined || arr.length === 0) return false
16+
return true
1517
}
1618

1719
const execResult = (err = null, out, outerr = null) => {

0 commit comments

Comments
 (0)