@j-o-r/sh 1.1.20 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/SH.js +15 -0
- package/package.json +1 -1
- package/types/SH.d.ts +8 -0
package/lib/SH.js
CHANGED
|
@@ -72,6 +72,20 @@ const jsType = (fn) => {
|
|
|
72
72
|
const type = Object.prototype.toString.call(fn).slice(8, -1);
|
|
73
73
|
return type === 'Object' ? fn.constructor.name : type;
|
|
74
74
|
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 'Code Safe' has own prop
|
|
78
|
+
*
|
|
79
|
+
* @param {any} o - object to examine
|
|
80
|
+
* @param {string} p - property to look for
|
|
81
|
+
* @returns {boolean}
|
|
82
|
+
*/
|
|
83
|
+
const hasProp = (o, p) => {
|
|
84
|
+
if (typeof o === 'undefined') {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return Object.prototype.hasOwnProperty.call(o, p);
|
|
88
|
+
};
|
|
75
89
|
/**
|
|
76
90
|
* 4ms, 5s || 5
|
|
77
91
|
* @param {number|string} d
|
|
@@ -372,6 +386,7 @@ export {
|
|
|
372
386
|
expBackoff,
|
|
373
387
|
parseArgs,
|
|
374
388
|
jsType,
|
|
389
|
+
hasProp,
|
|
375
390
|
Test,
|
|
376
391
|
assert,
|
|
377
392
|
AsyncTracker
|
package/package.json
CHANGED
package/types/SH.d.ts
CHANGED
|
@@ -149,6 +149,14 @@ export function parseArgs(args?: string[]): ArgsObject;
|
|
|
149
149
|
* @returns {string} The "real" object / typeof name
|
|
150
150
|
*/
|
|
151
151
|
export function jsType(fn: any): string;
|
|
152
|
+
/**
|
|
153
|
+
* 'Code Safe' has own prop
|
|
154
|
+
*
|
|
155
|
+
* @param {any} o - object to examine
|
|
156
|
+
* @param {string} p - property to look for
|
|
157
|
+
* @returns {boolean}
|
|
158
|
+
*/
|
|
159
|
+
export function hasProp(o: any, p: string): boolean;
|
|
152
160
|
import Test from './Test.js';
|
|
153
161
|
import assert from 'node:assert';
|
|
154
162
|
import AsyncTracker from './AsyncTracker.js';
|