@pezkuwi/util 14.0.10 → 14.0.11
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/array/chunk.d.ts +15 -0
- package/array/chunk.js +27 -0
- package/array/filter.d.ts +16 -0
- package/array/filter.js +19 -0
- package/array/flatten.d.ts +15 -0
- package/array/flatten.js +39 -0
- package/array/index.d.ts +10 -0
- package/array/index.js +10 -0
- package/array/range.d.ts +16 -0
- package/array/range.js +25 -0
- package/array/shuffle.d.ts +5 -0
- package/array/shuffle.js +19 -0
- package/array/unzip.d.ts +5 -0
- package/array/unzip.js +13 -0
- package/array/zip.d.ts +5 -0
- package/array/zip.js +12 -0
- package/assert.d.ts +29 -0
- package/assert.js +39 -0
- package/bi/consts.d.ts +90 -0
- package/bi/consts.js +91 -0
- package/bi/helpers.d.ts +2 -0
- package/bi/helpers.js +16 -0
- package/bi/index.d.ts +9 -0
- package/bi/index.js +9 -0
- package/bi/min.d.ts +10 -0
- package/bi/min.js +11 -0
- package/bi/sqrt.d.ts +7 -0
- package/bi/sqrt.js +29 -0
- package/bi/toBigInt.d.ts +7 -0
- package/bi/toBigInt.js +25 -0
- package/bi/toHex.d.ts +7 -0
- package/bi/toHex.js +9 -0
- package/bi/toU8a.d.ts +7 -0
- package/bi/toU8a.js +49 -0
- package/bn/bn.d.ts +2 -0
- package/bn/bn.js +2 -0
- package/bn/consts.d.ts +91 -0
- package/bn/consts.js +91 -0
- package/bn/fromHex.d.ts +1 -0
- package/bn/fromHex.js +1 -0
- package/bn/index.d.ts +11 -0
- package/bn/index.js +11 -0
- package/bn/min.d.ts +29 -0
- package/bn/min.js +29 -0
- package/bn/sqrt.d.ts +16 -0
- package/bn/sqrt.js +38 -0
- package/bn/toBn.d.ts +19 -0
- package/bn/toBn.js +37 -0
- package/bn/toHex.d.ts +18 -0
- package/bn/toHex.js +20 -0
- package/bn/toU8a.d.ts +17 -0
- package/bn/toU8a.js +33 -0
- package/buffer/index.d.ts +4 -0
- package/buffer/index.js +4 -0
- package/buffer/toU8a.d.ts +15 -0
- package/buffer/toU8a.js +17 -0
- package/bundle-pezkuwi-util.js +4830 -0
- package/bundle.d.ts +28 -0
- package/bundle.js +28 -0
- package/cjs/array/chunk.d.ts +15 -0
- package/cjs/array/chunk.js +30 -0
- package/cjs/array/filter.d.ts +16 -0
- package/cjs/array/filter.js +22 -0
- package/cjs/array/flatten.d.ts +15 -0
- package/cjs/array/flatten.js +42 -0
- package/cjs/array/index.d.ts +10 -0
- package/cjs/array/index.js +20 -0
- package/cjs/array/range.d.ts +16 -0
- package/cjs/array/range.js +28 -0
- package/cjs/array/shuffle.d.ts +5 -0
- package/cjs/array/shuffle.js +22 -0
- package/cjs/array/unzip.d.ts +5 -0
- package/cjs/array/unzip.js +16 -0
- package/cjs/array/zip.d.ts +5 -0
- package/cjs/array/zip.js +15 -0
- package/cjs/assert.d.ts +29 -0
- package/cjs/assert.js +44 -0
- package/cjs/bi/consts.d.ts +90 -0
- package/cjs/bi/consts.js +94 -0
- package/cjs/bi/helpers.d.ts +2 -0
- package/cjs/bi/helpers.js +19 -0
- package/cjs/bi/index.d.ts +9 -0
- package/cjs/bi/index.js +19 -0
- package/cjs/bi/min.d.ts +10 -0
- package/cjs/bi/min.js +14 -0
- package/cjs/bi/sqrt.d.ts +7 -0
- package/cjs/bi/sqrt.js +32 -0
- package/cjs/bi/toBigInt.d.ts +7 -0
- package/cjs/bi/toBigInt.js +28 -0
- package/cjs/bi/toHex.d.ts +7 -0
- package/cjs/bi/toHex.js +12 -0
- package/cjs/bi/toU8a.d.ts +7 -0
- package/cjs/bi/toU8a.js +52 -0
- package/cjs/bn/bn.d.ts +2 -0
- package/cjs/bn/bn.js +6 -0
- package/cjs/bn/consts.d.ts +91 -0
- package/cjs/bn/consts.js +94 -0
- package/cjs/bn/fromHex.d.ts +1 -0
- package/cjs/bn/fromHex.js +5 -0
- package/cjs/bn/index.d.ts +11 -0
- package/cjs/bn/index.js +23 -0
- package/cjs/bn/min.d.ts +29 -0
- package/cjs/bn/min.js +32 -0
- package/cjs/bn/sqrt.d.ts +16 -0
- package/cjs/bn/sqrt.js +41 -0
- package/cjs/bn/toBn.d.ts +19 -0
- package/cjs/bn/toBn.js +40 -0
- package/cjs/bn/toHex.d.ts +18 -0
- package/cjs/bn/toHex.js +23 -0
- package/cjs/bn/toU8a.d.ts +17 -0
- package/cjs/bn/toU8a.js +36 -0
- package/cjs/buffer/index.d.ts +4 -0
- package/cjs/buffer/index.js +8 -0
- package/cjs/buffer/toU8a.d.ts +15 -0
- package/cjs/buffer/toU8a.js +20 -0
- package/cjs/bundle.d.ts +28 -0
- package/cjs/bundle.js +33 -0
- package/cjs/compact/addLength.d.ts +13 -0
- package/cjs/compact/addLength.js +23 -0
- package/cjs/compact/defaults.d.ts +3 -0
- package/cjs/compact/defaults.js +5 -0
- package/cjs/compact/fromU8a.d.ts +22 -0
- package/cjs/compact/fromU8a.js +92 -0
- package/cjs/compact/index.d.ts +24 -0
- package/cjs/compact/index.js +32 -0
- package/cjs/compact/stripLength.d.ts +13 -0
- package/cjs/compact/stripLength.js +24 -0
- package/cjs/compact/toU8a.d.ts +14 -0
- package/cjs/compact/toU8a.js +48 -0
- package/cjs/compact/types.d.ts +1 -0
- package/cjs/compact/types.js +2 -0
- package/cjs/detectPackage.d.ts +17 -0
- package/cjs/detectPackage.js +100 -0
- package/cjs/extractTime.d.ts +14 -0
- package/cjs/extractTime.js +56 -0
- package/cjs/float/index.d.ts +1 -0
- package/cjs/float/index.js +5 -0
- package/cjs/float/toU8a.d.ts +11 -0
- package/cjs/float/toU8a.js +22 -0
- package/cjs/format/formatBalance.d.ts +54 -0
- package/cjs/format/formatBalance.js +88 -0
- package/cjs/format/formatDate.d.ts +5 -0
- package/cjs/format/formatDate.js +20 -0
- package/cjs/format/formatDecimal.d.ts +5 -0
- package/cjs/format/formatDecimal.js +19 -0
- package/cjs/format/formatElapsed.d.ts +7 -0
- package/cjs/format/formatElapsed.js +30 -0
- package/cjs/format/formatNumber.d.ts +14 -0
- package/cjs/format/formatNumber.js +14 -0
- package/cjs/format/getSeparator.d.ts +9 -0
- package/cjs/format/getSeparator.js +14 -0
- package/cjs/format/index.d.ts +6 -0
- package/cjs/format/index.js +16 -0
- package/cjs/format/si.d.ts +9 -0
- package/cjs/format/si.js +45 -0
- package/cjs/has.d.ts +14 -0
- package/cjs/has.js +19 -0
- package/cjs/hex/addPrefix.d.ts +16 -0
- package/cjs/hex/addPrefix.js +23 -0
- package/cjs/hex/fixLength.d.ts +18 -0
- package/cjs/hex/fixLength.js +30 -0
- package/cjs/hex/hasPrefix.d.ts +16 -0
- package/cjs/hex/hasPrefix.js +21 -0
- package/cjs/hex/index.d.ts +12 -0
- package/cjs/hex/index.js +24 -0
- package/cjs/hex/stripPrefix.d.ts +15 -0
- package/cjs/hex/stripPrefix.js +30 -0
- package/cjs/hex/toBigInt.d.ts +6 -0
- package/cjs/hex/toBigInt.js +15 -0
- package/cjs/hex/toBn.d.ts +21 -0
- package/cjs/hex/toBn.js +35 -0
- package/cjs/hex/toNumber.d.ts +15 -0
- package/cjs/hex/toNumber.js +23 -0
- package/cjs/hex/toString.d.ts +15 -0
- package/cjs/hex/toString.js +22 -0
- package/cjs/hex/toU8a.d.ts +16 -0
- package/cjs/hex/toU8a.js +57 -0
- package/cjs/hex/toU8aBuffer.d.ts +16 -0
- package/cjs/hex/toU8aBuffer.js +43 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +5 -0
- package/cjs/is/array.d.ts +5 -0
- package/cjs/is/array.js +10 -0
- package/cjs/is/ascii.d.ts +8 -0
- package/cjs/is/ascii.js +43 -0
- package/cjs/is/bigInt.d.ts +15 -0
- package/cjs/is/bigInt.js +20 -0
- package/cjs/is/bn.d.ts +17 -0
- package/cjs/is/bn.js +22 -0
- package/cjs/is/boolean.d.ts +15 -0
- package/cjs/is/boolean.js +20 -0
- package/cjs/is/buffer.d.ts +16 -0
- package/cjs/is/buffer.js +24 -0
- package/cjs/is/childClass.d.ts +17 -0
- package/cjs/is/childClass.js +26 -0
- package/cjs/is/class.d.ts +6 -0
- package/cjs/is/class.js +9 -0
- package/cjs/is/codec.d.ts +12 -0
- package/cjs/is/codec.js +9 -0
- package/cjs/is/compact.d.ts +13 -0
- package/cjs/is/compact.js +9 -0
- package/cjs/is/error.d.ts +15 -0
- package/cjs/is/error.js +21 -0
- package/cjs/is/function.d.ts +17 -0
- package/cjs/is/function.js +20 -0
- package/cjs/is/helpers.d.ts +3 -0
- package/cjs/is/helpers.js +19 -0
- package/cjs/is/hex.d.ts +19 -0
- package/cjs/is/hex.js +27 -0
- package/cjs/is/index.d.ts +33 -0
- package/cjs/is/index.js +66 -0
- package/cjs/is/instanceOf.d.ts +15 -0
- package/cjs/is/instanceOf.js +21 -0
- package/cjs/is/ip.d.ts +18 -0
- package/cjs/is/ip.js +44 -0
- package/cjs/is/jsonObject.d.ts +27 -0
- package/cjs/is/jsonObject.js +40 -0
- package/cjs/is/null.d.ts +15 -0
- package/cjs/is/null.js +20 -0
- package/cjs/is/number.d.ts +15 -0
- package/cjs/is/number.js +20 -0
- package/cjs/is/object.d.ts +18 -0
- package/cjs/is/object.js +21 -0
- package/cjs/is/observable.d.ts +16 -0
- package/cjs/is/observable.js +19 -0
- package/cjs/is/promise.d.ts +1 -0
- package/cjs/is/promise.js +5 -0
- package/cjs/is/riscv.d.ts +7 -0
- package/cjs/is/riscv.js +20 -0
- package/cjs/is/string.d.ts +16 -0
- package/cjs/is/string.js +20 -0
- package/cjs/is/testChain.d.ts +1 -0
- package/cjs/is/testChain.js +10 -0
- package/cjs/is/toBigInt.d.ts +2 -0
- package/cjs/is/toBigInt.js +5 -0
- package/cjs/is/toBn.d.ts +2 -0
- package/cjs/is/toBn.js +5 -0
- package/cjs/is/u8a.d.ts +15 -0
- package/cjs/is/u8a.js +23 -0
- package/cjs/is/undefined.d.ts +15 -0
- package/cjs/is/undefined.js +20 -0
- package/cjs/is/utf8.d.ts +7 -0
- package/cjs/is/utf8.js +200 -0
- package/cjs/is/wasm.d.ts +7 -0
- package/cjs/is/wasm.js +15 -0
- package/cjs/lazy.d.ts +14 -0
- package/cjs/lazy.js +55 -0
- package/cjs/logger.d.ts +17 -0
- package/cjs/logger.js +122 -0
- package/cjs/memoize.d.ts +10 -0
- package/cjs/memoize.js +33 -0
- package/cjs/nextTick.d.ts +5 -0
- package/cjs/nextTick.js +27 -0
- package/cjs/noop.d.ts +8 -0
- package/cjs/noop.js +16 -0
- package/cjs/number/index.d.ts +5 -0
- package/cjs/number/index.js +10 -0
- package/cjs/number/toHex.d.ts +17 -0
- package/cjs/number/toHex.js +23 -0
- package/cjs/number/toU8a.d.ts +15 -0
- package/cjs/number/toU8a.js +22 -0
- package/cjs/object/clear.d.ts +5 -0
- package/cjs/object/clear.js +14 -0
- package/cjs/object/copy.d.ts +5 -0
- package/cjs/object/copy.js +11 -0
- package/cjs/object/entries.d.ts +9 -0
- package/cjs/object/entries.js +10 -0
- package/cjs/object/index.d.ts +7 -0
- package/cjs/object/index.js +18 -0
- package/cjs/object/keys.d.ts +5 -0
- package/cjs/object/keys.js +10 -0
- package/cjs/object/property.d.ts +10 -0
- package/cjs/object/property.js +38 -0
- package/cjs/object/spread.d.ts +6 -0
- package/cjs/object/spread.js +34 -0
- package/cjs/object/values.d.ts +5 -0
- package/cjs/object/values.js +10 -0
- package/cjs/package.json +3 -0
- package/cjs/packageDetect.d.ts +1 -0
- package/cjs/packageDetect.js +7 -0
- package/cjs/packageInfo.d.ts +6 -0
- package/cjs/packageInfo.js +4 -0
- package/cjs/promisify.d.ts +16 -0
- package/cjs/promisify.js +30 -0
- package/cjs/string/camelCase.d.ts +13 -0
- package/cjs/string/camelCase.js +62 -0
- package/cjs/string/index.d.ts +8 -0
- package/cjs/string/index.js +18 -0
- package/cjs/string/lowerFirst.d.ts +31 -0
- package/cjs/string/lowerFirst.js +40 -0
- package/cjs/string/shorten.d.ts +16 -0
- package/cjs/string/shorten.js +22 -0
- package/cjs/string/toHex.d.ts +16 -0
- package/cjs/string/toHex.js +22 -0
- package/cjs/string/toU8a.d.ts +16 -0
- package/cjs/string/toU8a.js +24 -0
- package/cjs/stringify.d.ts +6 -0
- package/cjs/stringify.js +18 -0
- package/cjs/types.d.ts +62 -0
- package/cjs/types.js +2 -0
- package/cjs/u8a/cmp.d.ts +17 -0
- package/cjs/u8a/cmp.js +49 -0
- package/cjs/u8a/concat.d.ts +24 -0
- package/cjs/u8a/concat.js +51 -0
- package/cjs/u8a/concatBuffer.d.ts +19 -0
- package/cjs/u8a/concatBuffer.js +29 -0
- package/cjs/u8a/empty.d.ts +7 -0
- package/cjs/u8a/empty.js +20 -0
- package/cjs/u8a/eq.d.ts +15 -0
- package/cjs/u8a/eq.js +40 -0
- package/cjs/u8a/fixLength.d.ts +17 -0
- package/cjs/u8a/fixLength.js +31 -0
- package/cjs/u8a/index.d.ts +18 -0
- package/cjs/u8a/index.js +42 -0
- package/cjs/u8a/sorted.d.ts +15 -0
- package/cjs/u8a/sorted.js +21 -0
- package/cjs/u8a/toBigInt.d.ts +6 -0
- package/cjs/u8a/toBigInt.js +73 -0
- package/cjs/u8a/toBn.d.ts +21 -0
- package/cjs/u8a/toBn.js +81 -0
- package/cjs/u8a/toBuffer.d.ts +16 -0
- package/cjs/u8a/toBuffer.js +24 -0
- package/cjs/u8a/toFloat.d.ts +11 -0
- package/cjs/u8a/toFloat.js +20 -0
- package/cjs/u8a/toHex.d.ts +16 -0
- package/cjs/u8a/toHex.js +56 -0
- package/cjs/u8a/toHexBuffer.d.ts +16 -0
- package/cjs/u8a/toHexBuffer.js +25 -0
- package/cjs/u8a/toNumber.d.ts +6 -0
- package/cjs/u8a/toNumber.js +61 -0
- package/cjs/u8a/toString.d.ts +15 -0
- package/cjs/u8a/toString.js +24 -0
- package/cjs/u8a/toU8a.d.ts +19 -0
- package/cjs/u8a/toU8a.js +42 -0
- package/cjs/u8a/wrap.d.ts +22 -0
- package/cjs/u8a/wrap.js +49 -0
- package/compact/addLength.d.ts +13 -0
- package/compact/addLength.js +20 -0
- package/compact/defaults.d.ts +3 -0
- package/compact/defaults.js +2 -0
- package/compact/fromU8a.d.ts +22 -0
- package/compact/fromU8a.js +88 -0
- package/compact/index.d.ts +24 -0
- package/compact/index.js +24 -0
- package/compact/stripLength.d.ts +13 -0
- package/compact/stripLength.js +21 -0
- package/compact/toU8a.d.ts +14 -0
- package/compact/toU8a.js +45 -0
- package/compact/types.d.ts +1 -0
- package/compact/types.js +1 -0
- package/detectPackage.d.ts +17 -0
- package/detectPackage.js +96 -0
- package/extractTime.d.ts +14 -0
- package/extractTime.js +53 -0
- package/float/index.d.ts +1 -0
- package/float/index.js +1 -0
- package/float/toU8a.d.ts +11 -0
- package/float/toU8a.js +19 -0
- package/format/formatBalance.d.ts +54 -0
- package/format/formatBalance.js +85 -0
- package/format/formatDate.d.ts +5 -0
- package/format/formatDate.js +17 -0
- package/format/formatDecimal.d.ts +5 -0
- package/format/formatDecimal.js +16 -0
- package/format/formatElapsed.d.ts +7 -0
- package/format/formatElapsed.js +27 -0
- package/format/formatNumber.d.ts +14 -0
- package/format/formatNumber.js +11 -0
- package/format/getSeparator.d.ts +9 -0
- package/format/getSeparator.js +11 -0
- package/format/index.d.ts +6 -0
- package/format/index.js +6 -0
- package/format/si.d.ts +9 -0
- package/format/si.js +40 -0
- package/has.d.ts +14 -0
- package/has.js +16 -0
- package/hex/addPrefix.d.ts +16 -0
- package/hex/addPrefix.js +20 -0
- package/hex/fixLength.d.ts +18 -0
- package/hex/fixLength.js +27 -0
- package/hex/hasPrefix.d.ts +16 -0
- package/hex/hasPrefix.js +18 -0
- package/hex/index.d.ts +12 -0
- package/hex/index.js +12 -0
- package/hex/stripPrefix.d.ts +15 -0
- package/hex/stripPrefix.js +27 -0
- package/hex/toBigInt.d.ts +6 -0
- package/hex/toBigInt.js +12 -0
- package/hex/toBn.d.ts +21 -0
- package/hex/toBn.js +32 -0
- package/hex/toNumber.d.ts +15 -0
- package/hex/toNumber.js +20 -0
- package/hex/toString.d.ts +15 -0
- package/hex/toString.js +19 -0
- package/hex/toU8a.d.ts +16 -0
- package/hex/toU8a.js +54 -0
- package/hex/toU8aBuffer.d.ts +16 -0
- package/hex/toU8aBuffer.js +40 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/is/array.d.ts +5 -0
- package/is/array.js +7 -0
- package/is/ascii.d.ts +8 -0
- package/is/ascii.js +40 -0
- package/is/bigInt.d.ts +15 -0
- package/is/bigInt.js +17 -0
- package/is/bn.d.ts +17 -0
- package/is/bn.js +19 -0
- package/is/boolean.d.ts +15 -0
- package/is/boolean.js +17 -0
- package/is/buffer.d.ts +16 -0
- package/is/buffer.js +21 -0
- package/is/childClass.d.ts +17 -0
- package/is/childClass.js +23 -0
- package/is/class.d.ts +6 -0
- package/is/class.js +6 -0
- package/is/codec.d.ts +12 -0
- package/is/codec.js +6 -0
- package/is/compact.d.ts +13 -0
- package/is/compact.js +6 -0
- package/is/error.d.ts +15 -0
- package/is/error.js +18 -0
- package/is/function.d.ts +17 -0
- package/is/function.js +17 -0
- package/is/helpers.d.ts +3 -0
- package/is/helpers.js +14 -0
- package/is/hex.d.ts +19 -0
- package/is/hex.js +23 -0
- package/is/index.d.ts +33 -0
- package/is/index.js +33 -0
- package/is/instanceOf.d.ts +15 -0
- package/is/instanceOf.js +18 -0
- package/is/ip.d.ts +18 -0
- package/is/ip.js +41 -0
- package/is/jsonObject.d.ts +27 -0
- package/is/jsonObject.js +37 -0
- package/is/null.d.ts +15 -0
- package/is/null.js +17 -0
- package/is/number.d.ts +15 -0
- package/is/number.js +17 -0
- package/is/object.d.ts +18 -0
- package/is/object.js +18 -0
- package/is/observable.d.ts +16 -0
- package/is/observable.js +16 -0
- package/is/promise.d.ts +1 -0
- package/is/promise.js +2 -0
- package/is/riscv.d.ts +7 -0
- package/is/riscv.js +17 -0
- package/is/string.d.ts +16 -0
- package/is/string.js +17 -0
- package/is/testChain.d.ts +1 -0
- package/is/testChain.js +7 -0
- package/is/toBigInt.d.ts +2 -0
- package/is/toBigInt.js +2 -0
- package/is/toBn.d.ts +2 -0
- package/is/toBn.js +2 -0
- package/is/u8a.d.ts +15 -0
- package/is/u8a.js +20 -0
- package/is/undefined.d.ts +15 -0
- package/is/undefined.js +17 -0
- package/is/utf8.d.ts +7 -0
- package/is/utf8.js +197 -0
- package/is/wasm.d.ts +7 -0
- package/is/wasm.js +12 -0
- package/lazy.d.ts +14 -0
- package/lazy.js +51 -0
- package/logger.d.ts +17 -0
- package/logger.js +118 -0
- package/memoize.d.ts +10 -0
- package/memoize.js +30 -0
- package/nextTick.d.ts +5 -0
- package/nextTick.js +24 -0
- package/noop.d.ts +8 -0
- package/noop.js +12 -0
- package/number/index.d.ts +5 -0
- package/number/index.js +5 -0
- package/number/toHex.d.ts +17 -0
- package/number/toHex.js +20 -0
- package/number/toU8a.d.ts +15 -0
- package/number/toU8a.js +19 -0
- package/object/clear.d.ts +5 -0
- package/object/clear.js +11 -0
- package/object/copy.d.ts +5 -0
- package/object/copy.js +8 -0
- package/object/entries.d.ts +9 -0
- package/object/entries.js +7 -0
- package/object/index.d.ts +7 -0
- package/object/index.js +7 -0
- package/object/keys.d.ts +5 -0
- package/object/keys.js +7 -0
- package/object/property.d.ts +10 -0
- package/object/property.js +34 -0
- package/object/spread.d.ts +6 -0
- package/object/spread.js +31 -0
- package/object/values.d.ts +5 -0
- package/object/values.js +7 -0
- package/package.json +1956 -12
- package/packageDetect.d.ts +1 -0
- package/packageDetect.js +5 -0
- package/packageInfo.d.ts +6 -0
- package/packageInfo.js +1 -0
- package/promisify.d.ts +16 -0
- package/promisify.js +27 -0
- package/string/camelCase.d.ts +13 -0
- package/string/camelCase.js +59 -0
- package/string/index.d.ts +8 -0
- package/string/index.js +8 -0
- package/string/lowerFirst.d.ts +31 -0
- package/string/lowerFirst.js +37 -0
- package/string/shorten.d.ts +16 -0
- package/string/shorten.js +19 -0
- package/string/toHex.d.ts +16 -0
- package/string/toHex.js +19 -0
- package/string/toU8a.d.ts +16 -0
- package/string/toU8a.js +21 -0
- package/stringify.d.ts +6 -0
- package/stringify.js +15 -0
- package/types.d.ts +62 -0
- package/types.js +1 -0
- package/u8a/cmp.d.ts +17 -0
- package/u8a/cmp.js +46 -0
- package/u8a/concat.d.ts +24 -0
- package/u8a/concat.js +47 -0
- package/u8a/concatBuffer.d.ts +19 -0
- package/u8a/concatBuffer.js +26 -0
- package/u8a/empty.d.ts +7 -0
- package/u8a/empty.js +17 -0
- package/u8a/eq.d.ts +15 -0
- package/u8a/eq.js +37 -0
- package/u8a/fixLength.d.ts +17 -0
- package/u8a/fixLength.js +28 -0
- package/u8a/index.d.ts +18 -0
- package/u8a/index.js +18 -0
- package/u8a/sorted.d.ts +15 -0
- package/u8a/sorted.js +18 -0
- package/u8a/toBigInt.d.ts +6 -0
- package/u8a/toBigInt.js +70 -0
- package/u8a/toBn.d.ts +21 -0
- package/u8a/toBn.js +78 -0
- package/u8a/toBuffer.d.ts +16 -0
- package/u8a/toBuffer.js +21 -0
- package/u8a/toFloat.d.ts +11 -0
- package/u8a/toFloat.js +17 -0
- package/u8a/toHex.d.ts +16 -0
- package/u8a/toHex.js +53 -0
- package/u8a/toHexBuffer.d.ts +16 -0
- package/u8a/toHexBuffer.js +22 -0
- package/u8a/toNumber.d.ts +6 -0
- package/u8a/toNumber.js +58 -0
- package/u8a/toString.d.ts +15 -0
- package/u8a/toString.js +21 -0
- package/u8a/toU8a.d.ts +19 -0
- package/u8a/toU8a.js +39 -0
- package/u8a/wrap.d.ts +22 -0
- package/u8a/wrap.js +43 -0
package/is/hex.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HexString } from '../types.js';
|
|
2
|
+
export declare const REGEX_HEX_PREFIXED: RegExp;
|
|
3
|
+
export declare const REGEX_HEX_NOPREFIX: RegExp;
|
|
4
|
+
/**
|
|
5
|
+
* @name isHex
|
|
6
|
+
* @summary Tests for a hex string.
|
|
7
|
+
* @description
|
|
8
|
+
* Checks to see if the input value is a `0x` prefixed hex string. Optionally (`bitLength` !== -1) checks to see if the bitLength is correct.
|
|
9
|
+
* @example
|
|
10
|
+
* <BR>
|
|
11
|
+
*
|
|
12
|
+
* ```javascript
|
|
13
|
+
* import { isHex } from '@pezkuwi/util';
|
|
14
|
+
*
|
|
15
|
+
* isHex('0x1234'); // => true
|
|
16
|
+
* isHex('0x1234', 8); // => false
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function isHex(value: unknown, bitLength?: number, ignoreLength?: boolean): value is HexString;
|
package/is/hex.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const REGEX_HEX_PREFIXED = /^0x[\da-fA-F]+$/;
|
|
2
|
+
export const REGEX_HEX_NOPREFIX = /^[\da-fA-F]+$/;
|
|
3
|
+
/**
|
|
4
|
+
* @name isHex
|
|
5
|
+
* @summary Tests for a hex string.
|
|
6
|
+
* @description
|
|
7
|
+
* Checks to see if the input value is a `0x` prefixed hex string. Optionally (`bitLength` !== -1) checks to see if the bitLength is correct.
|
|
8
|
+
* @example
|
|
9
|
+
* <BR>
|
|
10
|
+
*
|
|
11
|
+
* ```javascript
|
|
12
|
+
* import { isHex } from '@pezkuwi/util';
|
|
13
|
+
*
|
|
14
|
+
* isHex('0x1234'); // => true
|
|
15
|
+
* isHex('0x1234', 8); // => false
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function isHex(value, bitLength = -1, ignoreLength) {
|
|
19
|
+
return (typeof value === 'string' && (value === '0x' ||
|
|
20
|
+
REGEX_HEX_PREFIXED.test(value))) && (bitLength === -1
|
|
21
|
+
? (ignoreLength || (value.length % 2 === 0))
|
|
22
|
+
: (value.length === (2 + Math.ceil(bitLength / 4))));
|
|
23
|
+
}
|
package/is/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Type checking utilities
|
|
3
|
+
*/
|
|
4
|
+
export { isArray } from './array.js';
|
|
5
|
+
export { isAscii } from './ascii.js';
|
|
6
|
+
export { isBigInt } from './bigInt.js';
|
|
7
|
+
export { isBn } from './bn.js';
|
|
8
|
+
export { isBoolean } from './boolean.js';
|
|
9
|
+
export { isBuffer } from './buffer.js';
|
|
10
|
+
export { isChildClass } from './childClass.js';
|
|
11
|
+
export { isClass } from './class.js';
|
|
12
|
+
export { isCodec } from './codec.js';
|
|
13
|
+
export { isCompact } from './compact.js';
|
|
14
|
+
export { isError } from './error.js';
|
|
15
|
+
export { isFunction } from './function.js';
|
|
16
|
+
export { isHex } from './hex.js';
|
|
17
|
+
export { isInstanceOf } from './instanceOf.js';
|
|
18
|
+
export { isIp } from './ip.js';
|
|
19
|
+
export { isJsonObject } from './jsonObject.js';
|
|
20
|
+
export { isNull } from './null.js';
|
|
21
|
+
export { isNumber } from './number.js';
|
|
22
|
+
export { isObject } from './object.js';
|
|
23
|
+
export { isObservable } from './observable.js';
|
|
24
|
+
export { isPromise } from './promise.js';
|
|
25
|
+
export { isRiscV } from './riscv.js';
|
|
26
|
+
export { isString } from './string.js';
|
|
27
|
+
export { isTestChain } from './testChain.js';
|
|
28
|
+
export { isToBigInt } from './toBigInt.js';
|
|
29
|
+
export { isToBn } from './toBn.js';
|
|
30
|
+
export { isU8a } from './u8a.js';
|
|
31
|
+
export { isUndefined } from './undefined.js';
|
|
32
|
+
export { isUtf8 } from './utf8.js';
|
|
33
|
+
export { isWasm } from './wasm.js';
|
package/is/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Type checking utilities
|
|
3
|
+
*/
|
|
4
|
+
export { isArray } from './array.js';
|
|
5
|
+
export { isAscii } from './ascii.js';
|
|
6
|
+
export { isBigInt } from './bigInt.js';
|
|
7
|
+
export { isBn } from './bn.js';
|
|
8
|
+
export { isBoolean } from './boolean.js';
|
|
9
|
+
export { isBuffer } from './buffer.js';
|
|
10
|
+
export { isChildClass } from './childClass.js';
|
|
11
|
+
export { isClass } from './class.js';
|
|
12
|
+
export { isCodec } from './codec.js';
|
|
13
|
+
export { isCompact } from './compact.js';
|
|
14
|
+
export { isError } from './error.js';
|
|
15
|
+
export { isFunction } from './function.js';
|
|
16
|
+
export { isHex } from './hex.js';
|
|
17
|
+
export { isInstanceOf } from './instanceOf.js';
|
|
18
|
+
export { isIp } from './ip.js';
|
|
19
|
+
export { isJsonObject } from './jsonObject.js';
|
|
20
|
+
export { isNull } from './null.js';
|
|
21
|
+
export { isNumber } from './number.js';
|
|
22
|
+
export { isObject } from './object.js';
|
|
23
|
+
export { isObservable } from './observable.js';
|
|
24
|
+
export { isPromise } from './promise.js';
|
|
25
|
+
export { isRiscV } from './riscv.js';
|
|
26
|
+
export { isString } from './string.js';
|
|
27
|
+
export { isTestChain } from './testChain.js';
|
|
28
|
+
export { isToBigInt } from './toBigInt.js';
|
|
29
|
+
export { isToBn } from './toBn.js';
|
|
30
|
+
export { isU8a } from './u8a.js';
|
|
31
|
+
export { isUndefined } from './undefined.js';
|
|
32
|
+
export { isUtf8 } from './utf8.js';
|
|
33
|
+
export { isWasm } from './wasm.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isInstanceOf
|
|
3
|
+
* @summary Tests for a instance of a class.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is an instance of the test class.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isInstanceOf } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isInstanceOf', isInstanceOf(new Array(0), Array)); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isInstanceOf(value: unknown, Clazz: Function): boolean;
|
package/is/instanceOf.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isInstanceOf
|
|
3
|
+
* @summary Tests for a instance of a class.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is an instance of the test class.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isInstanceOf } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isInstanceOf', isInstanceOf(new Array(0), Array)); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function isInstanceOf(value, Clazz) {
|
|
16
|
+
return (((value && value.constructor) === Clazz) ||
|
|
17
|
+
value instanceof Clazz);
|
|
18
|
+
}
|
package/is/ip.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isIp
|
|
3
|
+
* @summary Tests if the value is a valid IP address
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the value is a valid IP address. Optionally check for either v4/v6
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isIp } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* isIp('192.168.0.1')); // => true
|
|
13
|
+
* isIp('1:2:3:4:5:6:7:8'); // => true
|
|
14
|
+
* isIp('192.168.0.1', 'v6')); // => false
|
|
15
|
+
* isIp('1:2:3:4:5:6:7:8', 'v4'); // => false
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function isIp(value: string, type?: 'v4' | 'v6'): boolean;
|
package/is/ip.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
|
|
2
|
+
const v6s = '[a-fA-F\\d]{1,4}';
|
|
3
|
+
const v6 = `
|
|
4
|
+
(?:
|
|
5
|
+
(?:${v6s}:){7}(?:${v6s}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
6
|
+
(?:${v6s}:){6}(?:${v4}|:${v6s}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
7
|
+
(?:${v6s}:){5}(?::${v4}|(?::${v6s}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
8
|
+
(?:${v6s}:){4}(?:(?::${v6s}){0,1}:${v4}|(?::${v6s}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
9
|
+
(?:${v6s}:){3}(?:(?::${v6s}){0,2}:${v4}|(?::${v6s}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
10
|
+
(?:${v6s}:){2}(?:(?::${v6s}){0,3}:${v4}|(?::${v6s}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
11
|
+
(?:${v6s}:){1}(?:(?::${v6s}){0,4}:${v4}|(?::${v6s}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
12
|
+
(?::(?:(?::${v6s}){0,5}:${v4}|(?::${v6s}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
13
|
+
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
14
|
+
`.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
|
|
15
|
+
const v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);
|
|
16
|
+
const v4exact = new RegExp(`^${v4}$`);
|
|
17
|
+
const v6exact = new RegExp(`^${v6}$`);
|
|
18
|
+
/**
|
|
19
|
+
* @name isIp
|
|
20
|
+
* @summary Tests if the value is a valid IP address
|
|
21
|
+
* @description
|
|
22
|
+
* Checks to see if the value is a valid IP address. Optionally check for either v4/v6
|
|
23
|
+
* @example
|
|
24
|
+
* <BR>
|
|
25
|
+
*
|
|
26
|
+
* ```javascript
|
|
27
|
+
* import { isIp } from '@pezkuwi/util';
|
|
28
|
+
*
|
|
29
|
+
* isIp('192.168.0.1')); // => true
|
|
30
|
+
* isIp('1:2:3:4:5:6:7:8'); // => true
|
|
31
|
+
* isIp('192.168.0.1', 'v6')); // => false
|
|
32
|
+
* isIp('1:2:3:4:5:6:7:8', 'v4'); // => false
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function isIp(value, type) {
|
|
36
|
+
switch (type) {
|
|
37
|
+
case 'v4': return v4exact.test(value);
|
|
38
|
+
case 'v6': return v6exact.test(value);
|
|
39
|
+
default: return v46Exact.test(value);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type ObjectIndexed = Record<string, any>;
|
|
2
|
+
/**
|
|
3
|
+
* @name isJsonObject
|
|
4
|
+
* @summary Tests for a valid JSON `object`.
|
|
5
|
+
* @description
|
|
6
|
+
* Checks to see if the input value is a valid JSON object.
|
|
7
|
+
* It returns false if the input is JSON parsable, but not an Javascript object.
|
|
8
|
+
* @example
|
|
9
|
+
* <BR>
|
|
10
|
+
*
|
|
11
|
+
* ```javascript
|
|
12
|
+
* import { isJsonObject } from '@pezkuwi/util';
|
|
13
|
+
*
|
|
14
|
+
* isJsonObject({}); // => true
|
|
15
|
+
* isJsonObject({
|
|
16
|
+
* "Test": "1234",
|
|
17
|
+
* "NestedTest": {
|
|
18
|
+
* "Test": "5678"
|
|
19
|
+
* }
|
|
20
|
+
* }); // => true
|
|
21
|
+
* isJsonObject(1234); // JSON parsable, but not an object => false
|
|
22
|
+
* isJsonObject(null); // JSON parsable, but not an object => false
|
|
23
|
+
* isJsonObject('not an object'); // => false
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function isJsonObject(value: unknown): value is ObjectIndexed;
|
|
27
|
+
export {};
|
package/is/jsonObject.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { stringify } from '../stringify.js';
|
|
2
|
+
/**
|
|
3
|
+
* @name isJsonObject
|
|
4
|
+
* @summary Tests for a valid JSON `object`.
|
|
5
|
+
* @description
|
|
6
|
+
* Checks to see if the input value is a valid JSON object.
|
|
7
|
+
* It returns false if the input is JSON parsable, but not an Javascript object.
|
|
8
|
+
* @example
|
|
9
|
+
* <BR>
|
|
10
|
+
*
|
|
11
|
+
* ```javascript
|
|
12
|
+
* import { isJsonObject } from '@pezkuwi/util';
|
|
13
|
+
*
|
|
14
|
+
* isJsonObject({}); // => true
|
|
15
|
+
* isJsonObject({
|
|
16
|
+
* "Test": "1234",
|
|
17
|
+
* "NestedTest": {
|
|
18
|
+
* "Test": "5678"
|
|
19
|
+
* }
|
|
20
|
+
* }); // => true
|
|
21
|
+
* isJsonObject(1234); // JSON parsable, but not an object => false
|
|
22
|
+
* isJsonObject(null); // JSON parsable, but not an object => false
|
|
23
|
+
* isJsonObject('not an object'); // => false
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function isJsonObject(value) {
|
|
27
|
+
const str = typeof value !== 'string'
|
|
28
|
+
? stringify(value)
|
|
29
|
+
: value;
|
|
30
|
+
try {
|
|
31
|
+
const obj = JSON.parse(str);
|
|
32
|
+
return typeof obj === 'object' && obj !== null;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/is/null.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isNull
|
|
3
|
+
* @summary Tests for a `null` values.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is `null`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isNull } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isNull', isNull(null)); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isNull(value?: unknown): value is null;
|
package/is/null.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isNull
|
|
3
|
+
* @summary Tests for a `null` values.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is `null`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isNull } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isNull', isNull(null)); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function isNull(value) {
|
|
16
|
+
return value === null;
|
|
17
|
+
}
|
package/is/number.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isNumber
|
|
3
|
+
* @summary Tests for a JavaScript number.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is a valid number.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isNumber } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isNumber', isNumber(1234)); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isNumber(value: unknown): value is number;
|
package/is/number.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isNumber
|
|
3
|
+
* @summary Tests for a JavaScript number.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is a valid number.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isNumber } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isNumber', isNumber(1234)); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function isNumber(value) {
|
|
16
|
+
return typeof value === 'number';
|
|
17
|
+
}
|
package/is/object.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type ObjectIndexed = Record<string, any>;
|
|
2
|
+
/**
|
|
3
|
+
* @name isObject
|
|
4
|
+
* @summary Tests for an `object`.
|
|
5
|
+
* @description
|
|
6
|
+
* Checks to see if the input value is a JavaScript object.
|
|
7
|
+
* @example
|
|
8
|
+
* <BR>
|
|
9
|
+
*
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { isObject } from '@pezkuwi/util';
|
|
12
|
+
*
|
|
13
|
+
* isObject({}); // => true
|
|
14
|
+
* isObject('something'); // => false
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function isObject<T extends ObjectIndexed = ObjectIndexed>(value?: unknown): value is T;
|
|
18
|
+
export {};
|
package/is/object.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isObject
|
|
3
|
+
* @summary Tests for an `object`.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is a JavaScript object.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isObject } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* isObject({}); // => true
|
|
13
|
+
* isObject('something'); // => false
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export function isObject(value) {
|
|
17
|
+
return !!value && typeof value === 'object';
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @name isBObservable
|
|
4
|
+
* @summary Tests for a `Observable` object instance.
|
|
5
|
+
* @description
|
|
6
|
+
* Checks to see if the input object is an instance of `BN` (bn.js).
|
|
7
|
+
* @example
|
|
8
|
+
* <BR>
|
|
9
|
+
*
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { isObservable } from '@pezkuwi/util';
|
|
12
|
+
*
|
|
13
|
+
* console.log('isObservable', isObservable(...));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const isObservable: (value?: unknown) => value is Observable;
|
package/is/observable.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isOn } from './helpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* @name isBObservable
|
|
4
|
+
* @summary Tests for a `Observable` object instance.
|
|
5
|
+
* @description
|
|
6
|
+
* Checks to see if the input object is an instance of `BN` (bn.js).
|
|
7
|
+
* @example
|
|
8
|
+
* <BR>
|
|
9
|
+
*
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { isObservable } from '@pezkuwi/util';
|
|
12
|
+
*
|
|
13
|
+
* console.log('isObservable', isObservable(...));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export const isObservable = /*#__PURE__*/ isOn('next');
|
package/is/promise.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPromise: (value?: unknown) => value is Promise<unknown>;
|
package/is/promise.js
ADDED
package/is/riscv.d.ts
ADDED
package/is/riscv.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { u8aEq } from '../u8a/eq.js';
|
|
2
|
+
import { isU8a } from './u8a.js';
|
|
3
|
+
const ELF_MAGIC = new Uint8Array([0x7f, 0x45, 0x4c, 0x46]); // ELF magic bytes: 0x7f, 'E', 'L', 'F'
|
|
4
|
+
const PVM_MAGIC = new Uint8Array([0x50, 0x56, 0x4d, 0x00]); // 'P', 'V', 'M', 0x00
|
|
5
|
+
/**
|
|
6
|
+
* @name isRiscV
|
|
7
|
+
* @summary Tests if the input has a RISC-V header
|
|
8
|
+
* @description
|
|
9
|
+
* Checks to see if the input Uint8Array contains a valid RISC-V header
|
|
10
|
+
*/
|
|
11
|
+
export function isRiscV(bytes) {
|
|
12
|
+
if (isU8a(bytes)) {
|
|
13
|
+
const start = bytes.subarray(0, 4);
|
|
14
|
+
return u8aEq(start, PVM_MAGIC) || u8aEq(start, ELF_MAGIC);
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
package/is/string.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnyString } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @name isString
|
|
4
|
+
* @summary Tests for a string.
|
|
5
|
+
* @description
|
|
6
|
+
* Checks to see if the input value is a JavaScript string.
|
|
7
|
+
* @example
|
|
8
|
+
* <BR>
|
|
9
|
+
*
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { isString } from '@pezkuwi/util';
|
|
12
|
+
*
|
|
13
|
+
* console.log('isString', isString('test')); // => true
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function isString(value: unknown): value is AnyString;
|
package/is/string.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isString
|
|
3
|
+
* @summary Tests for a string.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is a JavaScript string.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isString } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isString', isString('test')); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function isString(value) {
|
|
16
|
+
return typeof value === 'string' || value instanceof String;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTestChain(chain?: string | null): boolean;
|
package/is/testChain.js
ADDED
package/is/toBigInt.d.ts
ADDED
package/is/toBigInt.js
ADDED
package/is/toBn.d.ts
ADDED
package/is/toBn.js
ADDED
package/is/u8a.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isU8a
|
|
3
|
+
* @summary Tests for a `Uint8Array` object instance.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input object is an instance of `Uint8Array`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isUint8Array } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isU8a', isU8a([])); // => false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isU8a(value?: unknown): value is Uint8Array;
|
package/is/u8a.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isU8a
|
|
3
|
+
* @summary Tests for a `Uint8Array` object instance.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input object is an instance of `Uint8Array`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isUint8Array } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isU8a', isU8a([])); // => false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function isU8a(value) {
|
|
16
|
+
// here we defer the instanceof check which is actually slightly
|
|
17
|
+
// slower than just checking the constrctor (direct instances)
|
|
18
|
+
return (((value && value.constructor) === Uint8Array) ||
|
|
19
|
+
value instanceof Uint8Array);
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isUndefined
|
|
3
|
+
* @summary Tests for a `undefined` values.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is `undefined`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isUndefined } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isUndefined', isUndefined(void(0))); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isUndefined(value?: unknown): value is undefined;
|
package/is/undefined.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name isUndefined
|
|
3
|
+
* @summary Tests for a `undefined` values.
|
|
4
|
+
* @description
|
|
5
|
+
* Checks to see if the input value is `undefined`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { isUndefined } from '@pezkuwi/util';
|
|
11
|
+
*
|
|
12
|
+
* console.log('isUndefined', isUndefined(void(0))); // => true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function isUndefined(value) {
|
|
16
|
+
return value === undefined;
|
|
17
|
+
}
|
package/is/utf8.d.ts
ADDED