MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / parse

Function parse

lib/cloudDBAdapter.js:4–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3const stringify = obj => JSON.stringify(obj, null, 2)
4const parse = str =>
5 JSON.parse(str, (_, v) => {
6 if (
7 v !== null &&
8 typeof v === 'object' &&
9 'type' in v &&
10 v.type === 'Buffer' &&
11 'data' in v &&
12 Array.isArray(v.data)
13 ) {
14 return Buffer.from(v.data)
15 }
16 return v
17 })
18class CloudDBAdapter {
19 constructor(url, { serialize = stringify, deserialize = parse, fetchOptions = {} } = {}) {
20 this.url = url

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected