Comments (2)
The generated dist/Maybe/find.js
file is like what cdn.sykpack.dev generates for crocks.
import { c as curry_1, t as types, i as isFunction_1, a as isSameType_1 } from './types-79e513c1.js';
import { p as predOrFunc_1 } from './predOrFunc-a430cf4e.js';
import { h as hasAlg_1 } from './Maybe-f40e27d5.js';
import { M as Maybe } from './index-e9cd2952.js';
/** @license ISC License (c) copyright 2017 original and current authors */
/** @author Ian Hofmann-Hicks (evil) */
const hasAlg = hasAlg_1;
/** isFoldable :: a -> Boolean */
function isFoldable$1(m) {
return !!m
&& hasAlg('reduce', m)
}
var isFoldable_1 = isFoldable$1;
/** @license ISC License (c) copyright 2018 original and current authors */
/** @author Dale Francis (dalefrancis88) */
const Pred = types.proxy('Pred');
const curry = curry_1;
const predOrFunc = predOrFunc_1;
const isFunction = isFunction_1;
const isFoldable = isFoldable_1;
const isSameType = isSameType_1;
const { Just, Nothing } = Maybe.exports;
const accumulator = fn => (acc, cur) =>
!acc.found && predOrFunc(fn, cur) ? { found: true, value: cur } : acc;
/** find :: Foldable f => ((a -> Boolean) | Pred) -> f a -> Maybe a */
function find(fn, foldable) {
if(!isFunction(fn) && !isSameType(Pred, fn)) {
throw new TypeError('find: First argument must be a Pred or predicate')
}
if(!isFoldable(foldable)) {
throw new TypeError('find: Second argument must be a Foldable')
}
const result = foldable.reduce(accumulator(fn), { found: false });
return result.found ? Just(result.value) : Nothing()
}
var find_1 = curry(find);
export { find_1 as default };
from crocks.
Export conditions are widely supported now. Good time to pull the trigger on this
from crocks.
Related Issues (20)
- import crocks lib to crocks.dev for using in browser console HOT 2
- README.md example confusion with `curry` HOT 8
- `yarn run setup` problem with `node-sass` dependency
- `yarn run docs:dev` fails with `ReferenceError: primordials is not defined`. Node v12.
- Updating the framework used for docs HOT 11
- Adding support for Symbol properties HOT 1
- Incomplete docs HOT 5
- Documentation for React Application HOT 3
- Upgrading Tape to 5.x results in these tests failing
- `getProp` of `null` value returns a `Just` HOT 4
- [QUESTION]: ~> syntax, "lifting" functions HOT 2
- dimap in arrow HOT 2
- How to unwrap Monads for return statements that expect a value? HOT 11
- Allow ReaderT to work with Fluture HOT 4
- Add local function to Reader and ReaderT
- Add getPropOrError to crocks HOT 6
- Async 'race' and 'all' cancellation after first rejection
- Add pointfree Pair to array (pairToArray) function
- Add the StateT monad
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crocks.