New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@visisoft/staticland

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visisoft/staticland - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

dist/cjs/promise.js

12

dist/cjs/staticland.js

@@ -0,1 +1,5 @@

/* @license Apache-2.0
@visisoft/staticland v.0.1.10 visisoft.de
(Build date: 12/30/2020 - 2:26:07 PM)
*/
'use strict';

@@ -174,3 +178,3 @@

*/
// chainTap :: (a -> Promise *) -> Promise e a -> Promise e a
// chainTap :: (a -> Promise g *) -> Promise e a -> Promise (e|g) a
chainTap = semmelRamda.curry((fn, p) =>

@@ -232,2 +236,7 @@ new Promise((resolve, reject_) => {

// :: (a -> Boolean) -> a -> Maybe a
fromPredicate = semmelRamda.curry((predicate, x) =>
predicate(x) ? of$1(x) : nothing()
),
// Inspection //

@@ -355,2 +364,3 @@

fromContentHolding: fromContentHolding,
fromPredicate: fromPredicate,
of: of$1,

@@ -357,0 +367,0 @@ nothing: nothing,

14

package.json

@@ -11,6 +11,7 @@ {

"devDependencies": {
"@rollup/plugin-node-resolve": "^11.0.1",
"chai": "^4.2.0",
"es-module-shims": "^0.4.6",
"hirestime": "^6.0.1",
"rollup": "^2.26.8"
"rollup": "^2.35.1"
},

@@ -22,3 +23,6 @@ "exports": {

},
"./promise": "./src/promise.js",
"./promise": {
"require": "./dist/cjs/promise.js",
"default": "./src/promise.js"
},
"./maybe": "./src/maybe.js",

@@ -51,4 +55,4 @@ "./either": "./src/either.js",

"scripts": {
"build:cjs": "rollup ./index.js --file dist/cjs/staticland.js --format cjs --external semmel-ramda",
"prepare": "npm run build:cjs",
"build:cjs": "rollup -c",
"prepack": "npm run test && npm run build:cjs",
"setup:chai": "rollup --input node_modules/chai/chai.js --file test/helpers/chai.mjs -c scripts/rollup.cjs-dependencies.config.js",

@@ -60,3 +64,3 @@ "setup:hirestime": "rollup --input node_modules/hirestime/dist/index.js --file test/helpers/hirestime.mjs -c scripts/rollup.cjs-dependencies.config.js",

"type": "module",
"version": "0.1.9"
"version": "0.1.10"
}

@@ -5,4 +5,15 @@ [![Dependencies](https://img.shields.io/david/semmel/StaticLand.svg?style=flat-square)](https://david-dm.org/semmel/StaticLand) [![NPM Version](https://img.shields.io/npm/v/@visisoft/staticland.svg?style=flat-square)](https://www.npmjs.com/package/@visisoft/staticland)

====================
Operations on Algebraic Data Types (ADT) (Either, Maybe, Promise) realised with *free static functions*. The static functions do not expect custom-made ADTs but work on the *native JavaScript types* as `Array` and `Promise`. Using these native types means that *@visisoft/staticland* practically gives up on type inspection and leaves that to the calling code. This is in line with the characteristics of JavaScript.
Operations on Algebraic Data Types (ADT) (Either, Maybe, Promise) realised with *free static functions*. The static functions do not expect custom-made ADTs but work on the *native JavaScript types* as `Array`, `Promise` and `Function`. Using these native types means that
- *@visisoft/staticland* practically gives up on type inspection and leaves that to the calling code. This is in line with the characteristics of JavaScript.
- The implementation of the static functions is mostly trivial
| | `of` | `map` | `chain` | Consumption |
|-----------|---------------|---------------|---------------|---------------|
| Maybe | `x => [x]` |`Array.prototype.map`|`Array.prototype.flatMap`|`xs => xs[0]`|
| Promise | `Promise.resolve`|`Promise.then`|`Promise.then`|`Promise.then`|
| IO | `x => x` |`compose` |`run(compose)` |`call`|
In a way @visisoft/staticland provides functions which operate on and access types you operate with anyway.
Hello @visisoft/staticland

@@ -17,2 +28,4 @@ --------------------------

#### Usage in an ES module
```javascript

@@ -49,2 +62,12 @@ import {map as map_p, mapRej as mapRej_p, chain as chain_p} from '@visisoft/staticland/promise';

#### Usage in a CommonJS module
```javascript
const
{chain: chain_p} = require('@visisoft/staticland/promise'),
delay = t => x => new Promise(resolve => setTimeout(resolve, t, x));
chain(delay(500), Promise.resolve("foo")).then(console.log);
```
Objective

@@ -83,2 +106,2 @@ ---------

[ramda-fantasy]: https://github.com/ramda/ramda-fantasy
[crocks]: https://crocks.dev/docs/crocks/
[crocks]: https://crocks.dev/docs/crocks/

@@ -34,2 +34,7 @@ /**

// :: (a -> Boolean) -> a -> Maybe a
fromPredicate = curry((predicate, x) =>
predicate(x) ? of(x) : nothing()
),
// Inspection //

@@ -151,3 +156,3 @@

export {
equals, fromNilable, fromContentHolding, of, nothing, isJust, isNothing, join, lift,
equals, fromNilable, fromContentHolding, fromPredicate, of, nothing, isJust, isNothing, join, lift,
map, maybe, chain, ap, reduce, tap, getOrElse,

@@ -154,0 +159,0 @@ typeString

@@ -171,3 +171,3 @@ /**

*/
// chainTap :: (a -> Promise *) -> Promise e a -> Promise e a
// chainTap :: (a -> Promise g *) -> Promise e a -> Promise (e|g) a
chainTap = curry((fn, p) =>

@@ -174,0 +174,0 @@ new Promise((resolve, reject_) => {

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