+// high excluded
function randomInt (low: number, high: number) {
return Math.floor(Math.random() * (high - low) + low)
}
const l = Math.min(segmentsA.length, segmentsB.length)
for (let i = 0; i < l; i++) {
- const diff = parseInt(segmentsA[ i ], 10) - parseInt(segmentsB[ i ], 10)
+ const diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10)
if (diff) return diff
}
return segmentsA.length - segmentsB.length
}
+function isPromise (value: any) {
+ return value && typeof value.then === 'function'
+}
+
+function isCatchable (value: any) {
+ return value && typeof value.catch === 'function'
+}
+
export {
randomInt,
- compareSemVer
+ compareSemVer,
+ isPromise,
+ isCatchable
}