Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
fix: syntax tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Apr 8, 2020
1 parent 2074f00 commit 7906f08
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { openDB, deleteDB } = require('idb')
const { Key, Errors, utils } = require('interface-datastore')
const { filter, sortAll } = utils

function isStrictTypedArray (arr) {
const isStrictTypedArray = (arr) => {
return (
arr instanceof Int8Array ||
arr instanceof Int16Array ||
Expand All @@ -19,10 +19,10 @@ function isStrictTypedArray (arr) {
)
}

function typedarrayToBuffer (arr) {
const typedarrayToBuffer = (arr) => {
if (isStrictTypedArray(arr)) {
// To avoid a copy, use the typed array's underlying ArrayBuffer to back new Buffer
var buf = Buffer.from(arr.buffer)
let buf = Buffer.from(arr.buffer)
if (arr.byteLength !== arr.buffer.byteLength) {
// Respect the "view", i.e. byteOffset and byteLength, without doing a copy
buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength)
Expand All @@ -34,10 +34,10 @@ function typedarrayToBuffer (arr) {
}
}

function str2ab (str) {
var buf = new ArrayBuffer(str.length)
var bufView = new Uint8Array(buf)
for (var i = 0, strLen = str.length; i < strLen; i++) {
const str2ab = (str) => {
const buf = new ArrayBuffer(str.length)
const bufView = new Uint8Array(buf)
for (let i = 0, strLen = str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i)
}
return buf
Expand Down

0 comments on commit 7906f08

Please sign in to comment.