Skip to content

Conversation

@wincent
Copy link
Contributor

@wincent wincent commented Oct 23, 2015

We already export a cursorForObjectInConnection method which itself calls offsetToCursor, but because it relies internally on Array.prototype.indexOf to derive the offset, it is not well suited for use cases where objects may be equivalent but not strictly equal (===).

By exporting offsetToCursor, schema authors can derive cursors on their own without having to go through cursorForObjectInConnection. This mirrors what we do with cursorToOffset, which is already exported.

Fixes: #29

We already export a `cursorForObjectInConnection` method which itself
calls `offsetToCursor`, but because it relies internally on
`Array.prototype.indexOf` to derive the offset, it is not well suited
for use cases where objects may be equivalent but not strictly equal
(`===`).

By exporting `offsetToCursor`, schema authors can derive cursors on
their own without having to go through `cursorForObjectInConnection`.
This mirrors what we do with `cursorToOffset`, which is already
exported.

Fixes: #29
steveluscher added a commit that referenced this pull request Oct 23, 2015
Expose `offsetToCursor` method
@steveluscher steveluscher merged commit 0418640 into graphql:master Oct 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants