electrum-utils v1.6.7
Electrum utilities
React components which work with Electrum might need some of the functionality provided by these utility functions.
getInstanceMethodNames (obj, stop)
→ gets an array of method names by walkingobj
's prototype chain until (optional) prototypestop
is reached.
See Enumerating methods on a JavaScript class instance for a discussion on how this works.getTextSelection (element)
→ gets the selection as an object containing afrom
and ato
position. Example selection:{from: 3, to: 8}
. Cursor position without selection:from: 3, to: 3}
.shallowEqual (objA, objB)
→ returnstrue
if both objects contain the same keys and values (the comparison is done by reference equality).startsWithLowerCase (string)
→ returnstrue
if the text starts with a lower case character (a-z, no accented characters).startsWithUpperCase (string)
→ returnstrue
if the text starts with an upper case character (A-Z, no accented characters).