Socket
Socket
Sign inDemoInstall

effects-as-data

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

effects-as-data - npm Package Compare versions

Comparing version 0.3.0 to 1.1.0

README.md

56

package.json
{
"name": "effects-as-data",
"version": "0.3.0",
"description": "Express complex async workflows using only pure functions.",
"main": "index.js",
"version": "1.1.0",
"description": "",
"main": "lib/index.js",
"scripts": {
"precommit": "npm run lint; npm run transpile; npm run test-lib",
"transpile": "rm -rf ./lib; babel ./src --out-dir ./lib --source-maps",
"lint": "standard",
"test": "mocha src/**/*.spec.js",
"test-lib": "mocha lib/**/*.spec.js",
"watch-test": "mocha src/**/*.spec.js -watch"
"test": "jest",
"demo": "npm run transpile; node lib/demo/repos.js",
"transpile": "babel src --out-dir lib --source-maps"
},
"repository": {
"type": "git",
"url": "git+https://github.com/orourkedd/effects-as-data.git"
"author": "",
"license": "ISC",
"dependencies": {
"ramda": "^0.22.1"
},
"author": "orourkedd",
"license": "MIT",
"bugs": {
"url": "https://github.com/orourkedd/effects-as-data/issues"
},
"homepage": "https://github.com/orourkedd/effects-as-data#readme",
"devDependencies": {
"babel-core": "^6.17.0",
"babel-preset-es2015": "^6.16.0",
"babel-cli": "^6.18.0",
"babel-eslint": "^7.1.1",
"babel-jest": "^17.0.2",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-transform-async-functions": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.16.1",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"chai": "^3.5.0",
"husky": "^0.11.8",
"mocha": "^3.1.0",
"jest-cli": "^17.0.3",
"simple-protocol-http": "^0.5.0",
"sinon": "^1.17.6"
},
"dependencies": {
"ramda": "^0.22.1",
"safe-errors": "0.5.0"
},
"standard": {
"ignore": "lib",
"parser": "babel-eslint",
"globals": [
"describe",
"test",
"it",
"describe",
"beforeEach",
"afterEach",
"before",
"after"
"fail"
]
}
}

@@ -1,12 +0,27 @@

function toArray (a) {
if (typeof a === 'undefined') {
return []
} else if (Array.isArray(a)) {
const {
curry,
map,
prop,
pick,
zip,
has,
merge,
props,
append
} = require('ramda')
const unwrapArgs = (a) => {
if (!Array.isArray(a)) return a
if (a.length === 1) {
return a[0]
} else {
return a
} else {
return [a]
}
}
function toPromise (v) {
const toArray = (a) => {
return Array.isArray(a) ? a : [a]
}
const toPromise = (v) => {
if (!v || !v.then) {

@@ -19,12 +34,66 @@ return Promise.resolve(v)

function keyed (key, value) {
let patch = {}
patch[key] = value
return patch
function success (payload) {
return {
success: true,
payload
}
}
function isSuccess (p) {
return p.success === true
}
function failure (error) {
return {
success: false,
error
}
}
function isFailure (p) {
return p.success === false
}
const normalizeToSuccess = (p) => {
if (isProtocol(p)) return p
return success(p)
}
const normalizeListToSuccess = map(normalizeToSuccess)
const normalizeToFailure = (p) => {
if (isProtocol(p)) return p
return failure(p)
}
const isProtocol = (p) => {
if (!p) return false
const hasSuccess = has('success')
const hasPayload = has('payload')
const hasError = has('error')
if (hasSuccess(p) && (hasPayload(p) || hasError(p))) return true
return false
}
module.exports = {
unwrapArgs,
toArray,
toPromise,
keyed
curry,
map,
prop,
pick,
props,
zip,
has,
append,
success,
isSuccess,
failure,
isFailure,
merge,
normalizeToSuccess,
normalizeListToSuccess,
normalizeToFailure,
isProtocol
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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