@hyperjump/browser
Advanced tools
Comparing version 0.13.0 to 0.14.0
17
core.js
@@ -16,4 +16,5 @@ const makeFetchHappen = require("make-fetch-happen"); | ||
const get = curry(async (url, doc, options = {}) => { | ||
const get = curry(async (url, contextDoc, options = {}) => { | ||
let result; | ||
const doc = await contextDoc; | ||
const resolvedUrl = resolveUrl(doc.url, url); | ||
@@ -38,13 +39,13 @@ | ||
const step = curry(async (key, doc, options = {}) => isDocument(doc) ? ( | ||
contentTypeHandler(doc).step(key, doc, options) | ||
const step = curry(async (key, doc, options = {}) => isDocument(await doc) ? ( | ||
contentTypeHandler(await doc).step(key, await doc, options) | ||
) : ( | ||
doc[key] | ||
(await doc)[key] | ||
)); | ||
const entries = (doc, options = {}) => isDocument(doc) ? ( | ||
Promise.all(Object.keys(value(doc)) | ||
.map(async (key) => [key, await step(key, doc, options)])) | ||
const entries = async (doc, options = {}) => isDocument(await doc) ? ( | ||
Promise.all(Object.keys(value(await doc)) | ||
.map(async (key) => [key, await step(key, await doc, options)])) | ||
) : ( | ||
Object.entries(doc) | ||
Object.entries(await doc) | ||
); | ||
@@ -51,0 +52,0 @@ |
{ | ||
"name": "@hyperjump/browser", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "A generic hypermedia client for JSON Reference", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -117,3 +117,3 @@ Hyperjump Browser | ||
### `get` | ||
`(Url, Document, Options?) => Promise<Document>` | ||
`(Url, Document|Promise<Document>, Options?) => Promise<Document>` | ||
@@ -134,3 +134,3 @@ Retrieve a document with respect to a context document. Options can be passed to | ||
### `entries` | ||
`(Document|any, Options) => Promise<[string, Document|any][]>` | ||
`(Document|Promise<Document>|any, Options) => Promise<[string, Document|any][]>` | ||
@@ -140,3 +140,3 @@ An array of key/value pairs from a document whose value is an Object. | ||
### `step` | ||
`(string, Document|any, Options) => Promise<Document|any>` | ||
`(string, Document|Promise<Document>|any, Options) => Promise<Document|any>` | ||
@@ -146,3 +146,3 @@ Step into a document using the key given. | ||
### `map` | ||
`((Document|any) => T, Document|any, Options) => Promise<T[]>` | ||
`((Document|any) => T, Document|Promise<Document>|any, Options) => Promise<T[]>` | ||
@@ -152,3 +152,3 @@ A map function that works with promises and knows how to step into a document. | ||
### `filter` | ||
`((Document|any) => boolean, Document|any, Options) => Promise<(Document|any)[]>` | ||
`((Document|any) => boolean, Document|Promise<Document>|any, Options) => Promise<(Document|any)[]>` | ||
@@ -159,3 +159,3 @@ A filter function that works with promises and knows how to step into a | ||
### `reduce` | ||
`((T, Document|any) => T, T, Document|any, Options) => Promise<T>` | ||
`((T, Document|any) => T, T, Document|Promise<Document>|any, Options) => Promise<T>` | ||
@@ -166,3 +166,3 @@ A reduce function that works with promises and knows how to step into a | ||
### `pipeline` | ||
`(Function[], Document|any) => Promise<any>` | ||
`(Function[], Document|Promise<Document>|any) => Promise<any>` | ||
@@ -169,0 +169,0 @@ Compose an array of functions that call the next function with result of the |
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
16126
129