- Add GETTING_STARTED.md with quick start guide and development modes - Add INSTALL.sh automated installation script - Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md - Add QUICK_REFERENCE.md for common commands - Add SETUP_GUIDE.md with detailed setup instructions - Update README.md with improved project overview - Add did-wallet app dependencies and node_modules
21 lines
770 B
JavaScript
21 lines
770 B
JavaScript
export function digitCount (value) {
|
|
// Add a digit for negative numbers, as the sign will be prefixed
|
|
const sign = value < 0 ? 1 : 0
|
|
// Guard against negative numbers & zero going into log10(),
|
|
// as that would return -Infinity
|
|
value = Math.abs(Number(value || 1))
|
|
return Math.floor(Math.log10(value)) + 1 + sign
|
|
}
|
|
|
|
export function getType (value) {
|
|
if (ArrayBuffer.isView(value)) return 'arraybufferview'
|
|
if (Array.isArray(value)) return 'array'
|
|
if (value instanceof Number) return 'number'
|
|
if (value instanceof Boolean) return 'boolean'
|
|
if (value instanceof Set) return 'set'
|
|
if (value instanceof Map) return 'map'
|
|
if (value instanceof String) return 'string'
|
|
if (value instanceof ArrayBuffer) return 'arraybuffer'
|
|
return typeof value
|
|
}
|