Socket
Socket
Sign inDemoInstall

@hyperjump/pact

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperjump/pact - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

dist/pact-amd.js

35

package.json
{
"name": "@hyperjump/pact",
"version": "0.1.2",
"version": "0.2.0",
"description": "Higher order functions that work with promises",
"main": "lib/index.js",
"exports": {
"require": "./lib/index.js",
"import": "./lib/index.mjs"
},
"scripts": {
"clean": "xargs -a .gitignore rm -rf",
"lint": "eslint .",
"test": "mocha 'lib/**/*.spec.js'"
"lint": "eslint lib",
"test": "mocha --require ts-node/register 'lib/**/*.spec.ts'",
"build": "rollup --config rollup.config.js",
"prepublishOnly": "npm run build"
},
"repository": "github:jdesrosiers/hyperjump-pact",
"repository": "github:hyperjump-io/hyperjump-pact",
"keywords": [

@@ -27,7 +33,18 @@ "Hyperjump",

"devDependencies": {
"chai": "^4.2.0",
"eslint": "^4.19.1",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.18.0",
"mocha": "^5.2.0"
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.24.2",
"mocha": "^9.1.1",
"rollup": "^2.56.3",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "^10.2.1",
"typescript": "^4.4.2"
},

@@ -34,0 +51,0 @@ "dependencies": {

@@ -9,2 +9,4 @@ # Hyperjump Pact

## Installation
Includes support for node.js JavaScript (CommonJS and ES Modules), TypeScript,
and browsers.

@@ -37,5 +39,5 @@ ```bash

This example uses the API at https://swapi.hyperjump.io. It's a variation of the
[Star Wars API (SWAPI)](https://www.swapi.co) implemented using the [JRef][jref]
media type.
This example uses the API at [https://swapi.hyperjump.io](https://explore.hyperjump.io#https://swapi.hyperjump.io/api/films/1).
It's a variation of the [Star Wars API (SWAPI)](https://swapi.dev)
implemented using the [JRef][jref] media type.

@@ -83,36 +85,65 @@ ```javascript

### entries
`(object<A>) => Promise<[string, A][]>`
Similar to `Object.entries`.
### map
`((A, number?) => any, A[]|Promise<A[]>, Options) => Promise<any>`
Similar to `Array.map`.
```javascript
await map(async (n) => await n + 1, [Promise.resolve(1), Promise.resolve(2)])
// => [Promise.resolve(2), Promise.resolve(3)]
```
### filter
`((A, number?) => boolean|Promise<boolean>, A[]|Promise<A[]>, Options) => Promise<A[]>`
Similar to `Array.filter` except the return value of the test function can be a
`Promise<boolean>` as well as a `boolean`.
```javascript
await filter(async (n) => await n > 1, [Promise.resolve(1), Promise.resolve(2)])
// => [Promise.resolve(2)]
```
### reduce
`((B, A, number?) => B, A[]|Promise<A[]>, B, Options) => Promise<B>`
Similar to `Array.reduce` except optimized for Promises.
await reduce(async (sum, n) => sum + await n, 0, [Promise.resolve(1), Promise.resolve(2)])
// => 3
### some
`((A, number?) => boolean|Promise<boolean>, A[]|Promise<A[]>, Options) => Promise<boolean>`
Similar to `Array.some`.
```javascript
await some(async (n) => n > 1, [Promise.resolve(1), Promise.resolve(2)])
// => true
```
### every
`((A, number?) => boolean|Promise<boolean>, A|Promise<A>, Options) => Promise<boolean>`
Similar to `Array.every`.
```javascript
await every(async (n) => n > 1, [Promise.resolve(1), Promise.resolve(2)])
// => false
```
### pipeline
`(Function[], any) => Promise<any>`
Compose an array of functions that call the next function with result of the
previous function.
```javascript
await pipeline([
filter(async (n) => await n > 1),
map(async (n) => await n + 1),
reduce(async (sum, n) => sum + await n, 0)
], [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)])
// => 7
```
### all
`(Promise<A>[]) => A[]`
Same as the standard `Promise.all` except more convenient to use with
`pipeline`.
### allValues
`(object<Promise<A>>) => object<A>`
`allValues` is like `all` except it resolves promise for each value in an object
rather than each item in an array.
[hyperjump]: https://github.com/jdesrosiers/hyperjump-browser
[jref]: https://github.com/jdesrosiers/hyperjump-browser/blob/master/json-reference/README.md
[rollup]: https://rollupjs.org
[hyperjump]: https://github.com/hyperjump-io/browser
[jref]: https://github.com/hyperjump-io/browser/blob/master/lib/json-reference/README.md
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc