Comparing version 0.6.1 to 0.7.0
15
index.js
@@ -52,6 +52,11 @@ const { | ||
class BSONView extends ObjectView { | ||
toBSON() { | ||
return this.constructor.toBSON(this); | ||
getBSON(field) { | ||
const { View, start, length } = this.constructor.layout[field]; | ||
return View.toBSON(this, start, length); | ||
} | ||
toBSON(fields) { | ||
return this.constructor.toBSON(this, 0, 0, fields); | ||
} | ||
static from(object, view, start, length) { | ||
@@ -208,4 +213,4 @@ if (object && object instanceof Uint8Array) return this.fromBSON(object, view, start, length); | ||
static toBSON(view, start = 0) { | ||
const { fields, layout } = this; | ||
static toBSON(view, start = 0, length, fields = this.fields) { | ||
const { layout } = this; | ||
const result = {}; | ||
@@ -220,3 +225,3 @@ for (let i = 0; i < fields.length; i++) { | ||
static Array() { | ||
static get Array() { | ||
return ArrayViewMixin(this); | ||
@@ -223,0 +228,0 @@ } |
{ | ||
"name": "bsonview", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"description": "Schema-based BSON using structurae's ObjectView binary protocol.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16170
417