electrum-utils

1.6.7 • Public • Published

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 walking obj's prototype chain until (optional) prototype stop 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 a from and a to position. Example selection: {from: 3, to: 8}. Cursor position without selection: from: 3, to: 3}.

  • shallowEqual (objA, objB) → returns true if both objects contain the same keys and values (the comparison is done by reference equality).

  • startsWithLowerCase (string) → returns true if the text starts with a lower case character (a-z, no accented characters).

  • startsWithUpperCase (string) → returns true if the text starts with an upper case character (A-Z, no accented characters).

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i electrum-utils

    Weekly Downloads

    6

    Version

    1.6.7

    License

    MIT

    Last publish

    Collaborators

    • yvessaz
    • samlebarbare
    • catia
    • nocturnight
    • schroeterm
    • pierre.arnaud