Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.
/ level-js Public archive

Simplify value encoding aka serialization#76

Merged
vweevers merged 1 commit intomasterfrom
simplify-value-encoding
May 24, 2018
Merged

Simplify value encoding aka serialization#76
vweevers merged 1 commit intomasterfrom
simplify-value-encoding

Conversation

@vweevers
Copy link
Member

Baby steps. It's kind of a miracle that this passes tests 😄

Next step is to take the leap and upgrade abstract-leveldown, which will be a bigger PR.

Level.prototype._serializeValue = function (value, options) {
// TODO: do we still need to support ArrayBuffer?
if (value instanceof ArrayBuffer) return Buffer.from(value)
if (value == null) return ''
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same behavior as the default abstract _serializeValue.

if (options.raw) return value

// TODO: remove
if (typeof value !== 'object') return value.toString()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to memdown, in the next stage, level-js can just return the value as-is, without conversion.

@vweevers
Copy link
Member Author

Again I assigned, when I meant to request a review. 😦

@vweevers
Copy link
Member Author

The Chrome test has stalled. Looking into it.

@vweevers
Copy link
Member Author

vweevers commented May 23, 2018

image

It's a race issue of some sort, introduced by #68. Opening an issue: #77.

@ralphtheninja ralphtheninja self-assigned this May 23, 2018
@vweevers
Copy link
Member Author

I'll rebase this after fixing #77.

@vweevers vweevers changed the title Simplify value encoding aka serialization Simplify value encoding aka serialization [WIP] May 23, 2018
@vweevers vweevers force-pushed the simplify-value-encoding branch from c83fa41 to 057c43a Compare May 24, 2018 11:21
@vweevers vweevers changed the title Simplify value encoding aka serialization [WIP] Simplify value encoding aka serialization May 24, 2018
@vweevers vweevers merged commit 8c9f713 into master May 24, 2018
@vweevers vweevers deleted the simplify-value-encoding branch May 24, 2018 11:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants