rescript-js-iterator

    1.1.0 • Public • Published

    Rescript JS Iterator

    Rescript JS Iterator is a ReScript library that provides bindings to the JavaScript iterator protocol.

    Installation

    Using yarn or npm:

    yarn add rescript-js-iterator
    npm install --save rescript-js-iterator

    In your bsconfig.json, add:

    {
      "bs-dependencies": ["rescript-js-iterator"]
    }

    Usage

    module Iterator = Js_iterator
    
    let myIterable = getIterator() // previously defined function.
    
    let current = myIterable->Iterator.next
    
    let isDone = current->Iterator.done
    let value = current->Iterator.value
    
    /*
     * `done` and `value` are also available as properties of the object itself.
     */
    current.done == current->Iterator.done
    current.value == current->Iterator.value

    Contributing

    Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

    Please make sure to update tests as appropriate.

    License

    MIT

    Install

    npm i rescript-js-iterator

    DownloadsWeekly Downloads

    3

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    4.51 kB

    Total Files

    5

    Last publish

    Collaborators

    • oliverfencott