effects-as-data
Advanced tools
Comparing version 0.3.0 to 1.1.0
{ | ||
"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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1
206
37156
12
20
1118
2
2
1
- Removedsafe-errors@0.5.0
- Removedbluebird@3.7.2(transitive)
- Removedsafe-errors@0.5.0(transitive)