Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sanctuary

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanctuary - npm Package Compare versions

Comparing version 0.7.1 to 0.8.0

9

package.json
{
"name": "sanctuary",
"version": "0.7.1",
"version": "0.8.0",
"description": "Refuge from unsafe JavaScript",

@@ -11,8 +11,11 @@ "license": "MIT",

"dependencies": {
"ramda": "0.17.x"
"ramda": "0.19.x",
"sanctuary-def": "0.3.x"
},
"devDependencies": {
"istanbul": "0.3.x",
"doctest": "0.10.x",
"istanbul": "0.4.x",
"jscs": "1.10.x",
"jshint": "2.5.x",
"jsverify": "0.7.x",
"mocha": "2.x.x",

@@ -19,0 +22,0 @@ "transcribe": "0.3.x",

@@ -52,2 +52,9 @@ # Sanctuary

Sanctuary supports type classes: constraints on type variables. Whereas
`a -> a` implicitly supports every type, `Functor f => (a -> b) -> f a ->
f b` requires that `f` be a type which satisfies the requirements of the
Functor type class. Type-class constraints appear at the beginning of a
type signature, separated from the rest of the signature by a fat arrow
(`=>`).
### Accessible pseudotype

@@ -93,13 +100,27 @@

<h4 name="is"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L305">is :: TypeRep a -> b -> Boolean</a></code></h4>
<h4 name="type"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L286">type :: a -> String</a></code></h4>
Takes a value, `x`, of any type and returns its type identifier. If
`x` has a `'@@type'` property whose value is a string, `x['@@type']`
is the type identifier. Otherwise, the type identifier is the result
of applying [`R.type`][R.type] to `x`.
`'@@type'` properties should use the form `'<package-name>/<type-name>'`,
where `<package-name>` is the name of the npm package in which the type
is defined.
```javascript
> S.type(S.Just(42))
'sanctuary/Maybe'
> S.type([1, 2, 3])
'Array'
```
<h4 name="is"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L310">is :: TypeRep a -> b -> Boolean</a></code></h4>
Takes a [type representative](#type-representatives) and a value of
any type and returns `true` if the given value is of the specified
type (either directly or via the prototype chain); `false` otherwise.
type; `false` otherwise. Subtyping is not respected.
Boolean, number, string, and symbol [primitives][] are promoted to
their object equivalents. `42`, for example, is considered a Number
and an Object (whereas [`R.is`][R.is] considers it a Number but not
an Object).
```javascript

@@ -110,3 +131,3 @@ > S.is(Number, 42)

> S.is(Object, 42)
true
false

@@ -119,3 +140,3 @@ > S.is(String, 42)

<h4 name="I"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L330">I :: a -> a</a></code></h4>
<h4 name="I"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L340">I :: a -> a</a></code></h4>

@@ -127,6 +148,6 @@ The I combinator. Returns its argument. Equivalent to Haskell's `id`

> S.I('foo')
"foo"
'foo'
```
<h4 name="K"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L341">K :: a -> b -> a</a></code></h4>
<h4 name="K"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L355">K :: a -> b -> a</a></code></h4>

@@ -138,3 +159,3 @@ The K combinator. Takes two values and returns the first. Equivalent to

> S.K('foo', 'bar')
"foo"
'foo'

@@ -145,5 +166,63 @@ > R.map(S.K(42), R.range(0, 5))

### Function
<h4 name="flip"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L375">flip :: (a -> b -> c) -> b -> a -> c</a></code></h4>
Takes a binary function and two values and returns the result of
applying the function - with its argument order reversed - to the
values. `flip` may also be applied to a Ramda-style curried
function with arity greater than two.
```javascript
> R.map(S.flip(Math.pow)(2), [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]
```
<h4 name="lift"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L392">lift :: Functor f => (a -> b) -> f a -> f b</a></code></h4>
Promotes a unary function to a function which operates on a [Functor][].
```javascript
> S.lift(R.inc, S.Just(2))
S.Just(3)
> S.lift(R.inc, S.Nothing())
S.Nothing()
```
<h4 name="lift2"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L409">lift2 :: Apply f => (a -> b -> c) -> f a -> f b -> f c</a></code></h4>
Promotes a binary function to a function which operates on two
[Apply][]s.
```javascript
> S.lift2(R.add, S.Just(2), S.Just(3))
S.Just(5)
> S.lift2(R.add, S.Just(2), S.Nothing())
S.Nothing()
> S.lift2(S.and, S.Just(true), S.Just(true))
S.Just(true)
> S.lift2(S.and, S.Just(true), S.Just(false))
S.Just(false)
```
<h4 name="lift3"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L433">lift3 :: Apply f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d</a></code></h4>
Promotes a ternary function to a function which operates on three
[Apply][]s.
```javascript
> S.lift3(R.reduce, S.Just(R.add), S.Just(0), S.Just([1, 2, 3]))
S.Just(6)
> S.lift3(R.reduce, S.Just(R.add), S.Just(0), S.Nothing())
S.Nothing()
```
### Composition
<h4 name="compose"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L359">compose :: (b -> c) -> (a -> b) -> a -> c</a></code></h4>
<h4 name="compose"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L453">compose :: (b -> c) -> (a -> b) -> a -> c</a></code></h4>

@@ -164,3 +243,3 @@ Takes two functions assumed to be unary and a value of any type,

<h4 name="pipe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L379">pipe :: [(a -> b), (b -> c), ..., (m -> n)] -> a -> n</a></code></h4>
<h4 name="pipe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L474">pipe :: [(a -> b), (b -> c), ..., (m -> n)] -> a -> n</a></code></h4>

@@ -181,3 +260,3 @@ Takes a list of functions assumed to be unary and a value of any type,

<h4 name="meld"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L398">meld :: [** -> *] -> (* -> * -> ... -> *)</a></code></h4>
<h4 name="meld"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L495">meld :: [** -> *] -> (* -> * -> ... -> *)</a></code></h4>

@@ -211,3 +290,3 @@ Takes a list of non-nullary functions and returns a curried function

<h4 name="Maybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L436">Maybe :: TypeRep Maybe</a></code></h4>
<h4 name="Maybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L538">Maybe :: TypeRep Maybe</a></code></h4>

@@ -220,3 +299,3 @@ The Maybe type represents optional values: a value of type `Maybe a` is

<h4 name="Maybe.empty"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L447">Maybe.empty :: -> Maybe a</a></code></h4>
<h4 name="Maybe.empty"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L551">Maybe.empty :: -> Maybe a</a></code></h4>

@@ -230,3 +309,3 @@ Returns a Nothing.

<h4 name="Maybe.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L459">Maybe.of :: a -> Maybe a</a></code></h4>
<h4 name="Maybe.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L565">Maybe.of :: a -> Maybe a</a></code></h4>

@@ -240,4 +319,32 @@ Takes a value of any type and returns a Just with the given value.

<h4 name="Maybe.prototype.ap"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L471">Maybe#ap :: Maybe (a -> b) ~> Maybe a -> Maybe b</a></code></h4>
<h4 name="Maybe.prototype.@@type"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L579">Maybe#@@type :: String</a></code></h4>
Maybe type identifier, `'sanctuary/Maybe'`.
<h4 name="Maybe.prototype.isNothing"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L584">Maybe#isNothing :: Boolean</a></code></h4>
`true` if `this` is a Nothing; `false` if `this` is a Just.
```javascript
> S.Nothing().isNothing
true
> S.Just(42).isNothing
false
```
<h4 name="Maybe.prototype.isJust"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L596">Maybe#isJust :: Boolean</a></code></h4>
`true` if `this` is a Just; `false` if `this` is a Nothing.
```javascript
> S.Just(42).isJust
true
> S.Nothing().isJust
false
```
<h4 name="Maybe.prototype.ap"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L608">Maybe#ap :: Maybe (a -> b) ~> Maybe a -> Maybe b</a></code></h4>
Takes a value of type `Maybe a` and returns a Nothing unless `this`

@@ -259,3 +366,3 @@ is a Just *and* the argument is a Just, in which case it returns a

<h4 name="Maybe.prototype.chain"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L489">Maybe#chain :: Maybe a ~> (a -> Maybe b) -> Maybe b</a></code></h4>
<h4 name="Maybe.prototype.chain"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L631">Maybe#chain :: Maybe a ~> (a -> Maybe b) -> Maybe b</a></code></h4>

@@ -276,3 +383,3 @@ Takes a function and returns `this` if `this` is a Nothing; otherwise

<h4 name="Maybe.prototype.concat"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L505">Maybe#concat :: Maybe a ~> Maybe a -> Maybe a</a></code></h4>
<h4 name="Maybe.prototype.concat"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L652">Maybe#concat :: Semigroup a => Maybe a ~> Maybe a -> Maybe a</a></code></h4>

@@ -306,3 +413,3 @@ Returns the result of concatenating two Maybe values of the same type.

<h4 name="Maybe.prototype.empty"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L534">Maybe#empty :: Maybe a ~> Maybe a</a></code></h4>
<h4 name="Maybe.prototype.empty"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L689">Maybe#empty :: Maybe a ~> Maybe a</a></code></h4>

@@ -316,3 +423,3 @@ Returns a Nothing.

<h4 name="Maybe.prototype.equals"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L544">Maybe#equals :: Maybe a ~> b -> Boolean</a></code></h4>
<h4 name="Maybe.prototype.equals"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L703">Maybe#equals :: Maybe a ~> b -> Boolean</a></code></h4>

@@ -343,3 +450,3 @@ Takes a value of any type and returns `true` if:

<h4 name="Maybe.prototype.extend"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L570">Maybe#extend :: Maybe a ~> (Maybe a -> a) -> Maybe a</a></code></h4>
<h4 name="Maybe.prototype.extend"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L738">Maybe#extend :: Maybe a ~> (Maybe a -> a) -> Maybe a</a></code></h4>

@@ -351,10 +458,10 @@ Takes a function and returns `this` if `this` is a Nothing; otherwise

```javascript
> S.Nothing().extend(function(x) { return x.value + 1; })
> S.Nothing().extend(x => x.value + 1)
Nothing()
> S.Just(42).extend(function(x) { return x.value + 1; })
> S.Just(42).extend(x => x.value + 1)
Just(43)
```
<h4 name="Maybe.prototype.filter"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L584">Maybe#filter :: Maybe a ~> (a -> Boolean) -> Maybe a</a></code></h4>
<h4 name="Maybe.prototype.filter"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L757">Maybe#filter :: Maybe a ~> (a -> Boolean) -> Maybe a</a></code></h4>

@@ -365,10 +472,10 @@ Takes a predicate and returns `this` if `this` is a Just whose value

```javascript
> S.Just(42).filter(function(n) { return n % 2 === 0; })
> S.Just(42).filter(n => n % 2 === 0)
Just(42)
> S.Just(43).filter(function(n) { return n % 2 === 0; })
> S.Just(43).filter(n => n % 2 === 0)
Nothing()
```
<h4 name="Maybe.prototype.map"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L600">Maybe#map :: Maybe a ~> (a -> b) -> Maybe b</a></code></h4>
<h4 name="Maybe.prototype.map"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L775">Maybe#map :: Maybe a ~> (a -> b) -> Maybe b</a></code></h4>

@@ -387,3 +494,3 @@ Takes a function and returns `this` if `this` is a Nothing; otherwise

<h4 name="Maybe.prototype.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L614">Maybe#of :: Maybe a ~> b -> Maybe b</a></code></h4>
<h4 name="Maybe.prototype.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L796">Maybe#of :: Maybe a ~> b -> Maybe b</a></code></h4>

@@ -397,3 +504,3 @@ Takes a value of any type and returns a Just with the given value.

<h4 name="Maybe.prototype.reduce"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L624">Maybe#reduce :: Maybe a ~> (b -> a -> b) -> b -> b</a></code></h4>
<h4 name="Maybe.prototype.reduce"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L810">Maybe#reduce :: Maybe a ~> (b -> a -> b) -> b -> b</a></code></h4>

@@ -415,3 +522,3 @@ Takes a function and an initial value of any type, and returns:

<h4 name="Maybe.prototype.toBoolean"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L641">Maybe#toBoolean :: Maybe a ~> Boolean</a></code></h4>
<h4 name="Maybe.prototype.toBoolean"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L834">Maybe#toBoolean :: Maybe a ~> Boolean</a></code></h4>

@@ -428,3 +535,3 @@ Returns `false` if `this` is a Nothing; `true` if `this` is a Just.

<h4 name="Maybe.prototype.toString"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L653">Maybe#toString :: Maybe a ~> String</a></code></h4>
<h4 name="Maybe.prototype.toString"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L851">Maybe#toString :: Maybe a ~> String</a></code></h4>

@@ -435,15 +542,25 @@ Returns the string representation of the Maybe.

> S.Nothing().toString()
"Nothing()"
'Nothing()'
> S.Just([1, 2, 3]).toString()
"Just([1, 2, 3])"
'Just([1, 2, 3])'
```
<h4 name="Maybe.prototype.type"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L665">Maybe#type :: TypeRep Maybe</a></code></h4>
<h4 name="Maybe.prototype.inspect"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L871">Maybe#inspect :: Maybe a ~> String</a></code></h4>
A reference to the Maybe type. Useful for determining whether two
values such as `S.Nothing()` and `S.Just(42)` are of the same type.
Returns the string representation of the Maybe. This method is used by
`util.inspect` and the REPL to format a Maybe for display.
<h4 name="Nothing"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L671">Nothing :: -> Maybe a</a></code></h4>
See also [`Maybe#toString`](#Maybe.prototype.toString).
```javascript
> S.Nothing().inspect()
'Nothing()'
> S.Just([1, 2, 3]).inspect()
'Just([1, 2, 3])'
```
<h4 name="Nothing"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L887">Nothing :: -> Maybe a</a></code></h4>
Returns a Nothing. Though this is a constructor function the `new`

@@ -457,3 +574,3 @@ keyword needn't be used.

<h4 name="Just"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L721">Just :: a -> Maybe a</a></code></h4>
<h4 name="Just"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L903">Just :: a -> Maybe a</a></code></h4>

@@ -469,4 +586,28 @@ Takes a value of any type and returns a Just with the given value.

<h4 name="fromMaybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L787">fromMaybe :: a -> Maybe a -> a</a></code></h4>
<h4 name="isNothing"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L921">isNothing :: Maybe a -> Boolean</a></code></h4>
Returns `true` if the given Maybe is a Nothing; `false` if it is a Just.
```javascript
> S.isNothing(S.Nothing())
true
> S.isNothing(S.Just(42))
false
```
<h4 name="isJust"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L938">isJust :: Maybe a -> Boolean</a></code></h4>
Returns `true` if the given Maybe is a Just; `false` if it is a Nothing.
```javascript
> S.isJust(S.Just(42))
true
> S.isJust(S.Nothing())
false
```
<h4 name="fromMaybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L955">fromMaybe :: a -> Maybe a -> a</a></code></h4>
Takes a default value and a Maybe, and returns the Maybe's value

@@ -483,3 +624,3 @@ if the Maybe is a Just; the default value otherwise.

<h4 name="toMaybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L804">toMaybe :: a? -> Maybe a</a></code></h4>
<h4 name="toMaybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L973">toMaybe :: a? -> Maybe a</a></code></h4>

@@ -497,3 +638,3 @@ Takes a value and returns Nothing if the value is null or undefined;

<h4 name="maybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L819">maybe :: b -> (a -> b) -> Maybe a -> b</a></code></h4>
<h4 name="maybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L991">maybe :: b -> (a -> b) -> Maybe a -> b</a></code></h4>

@@ -512,3 +653,3 @@ Takes a value of any type, a function, and a Maybe. If the Maybe is

<h4 name="catMaybes"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L837">catMaybes :: [Maybe a] -> [a]</a></code></h4>
<h4 name="catMaybes"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1010">catMaybes :: [Maybe a] -> [a]</a></code></h4>

@@ -519,6 +660,6 @@ Takes a list of Maybes and returns a list containing each Just's value.

> S.catMaybes([S.Just('foo'), S.Nothing(), S.Just('baz')])
["foo", "baz"]
['foo', 'baz']
```
<h4 name="mapMaybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L848">mapMaybe :: (a -> Maybe b) -> [a] -> [b]</a></code></h4>
<h4 name="mapMaybe"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1024">mapMaybe :: (a -> Maybe b) -> [a] -> [b]</a></code></h4>

@@ -538,8 +679,8 @@ Takes a function and a list, applies the function to each element of

<h4 name="encase"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L864">encase :: (* -> a) -> (* -> Maybe a)</a></code></h4>
<h4 name="encase"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1044">encase :: (a -> b) -> a -> Maybe b</a></code></h4>
Takes a function `f` which may throw and returns a curried function
`g` which will not throw. The result of applying `g` is determined by
applying `f` to the same arguments: if this succeeds, `g` returns Just
the result; otherwise `g` returns Nothing.
Takes a unary function `f` which may throw and a value `x` of any type,
and applies `f` to `x` inside a `try` block. If an exception is caught,
the return value is a Nothing; otherwise the return value is Just the
result of applying `f` to `x`.

@@ -549,12 +690,20 @@ See also [`encaseEither`](#encaseEither).

```javascript
> S.encase(eval)('1 + 1')
> S.encase(eval, '1 + 1')
Just(2)
> S.encase(eval)('1 +')
> S.encase(eval, '1 +')
Nothing()
```
<h4 name="encase2"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1072">encase2 :: (a -> b -> c) -> a -> b -> Maybe c</a></code></h4>
Binary version of [`encase`](#encase).
<h4 name="encase3"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1087">encase3 :: (a -> b -> c -> d) -> a -> b -> c -> Maybe d</a></code></h4>
Ternary version of [`encase`](#encase).
### Either type
<h4 name="Either"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L892">Either :: TypeRep Either</a></code></h4>
<h4 name="Either"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1104">Either :: TypeRep Either</a></code></h4>

@@ -568,3 +717,3 @@ The Either type represents values with two possibilities: a value of type

<h4 name="Either.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L904">Either.of :: b -> Either a b</a></code></h4>
<h4 name="Either.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1118">Either.of :: b -> Either a b</a></code></h4>

@@ -578,4 +727,32 @@ Takes a value of any type and returns a Right with the given value.

<h4 name="Either.prototype.ap"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L916">Either#ap :: Either a (b -> c) ~> Either a b -> Either a c</a></code></h4>
<h4 name="Either.prototype.@@type"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1132">Either#@@type :: String</a></code></h4>
Either type identifier, `'sanctuary/Either'`.
<h4 name="Either.prototype.isLeft"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1137">Either#isLeft :: Boolean</a></code></h4>
`true` if `this` is a Left; `false` if `this` is a Right.
```javascript
> S.Left('Cannot divide by zero').isLeft
true
> S.Right(42).isLeft
false
```
<h4 name="Either.prototype.isRight"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1149">Either#isRight :: Boolean</a></code></h4>
`true` if `this` is a Right; `false` if `this` is a Left.
```javascript
> S.Right(42).isRight
true
> S.Left('Cannot divide by zero').isRight
false
```
<h4 name="Either.prototype.ap"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1161">Either#ap :: Either a (b -> c) ~> Either a b -> Either a c</a></code></h4>
Takes a value of type `Either a b` and returns a Left unless `this`

@@ -588,6 +765,6 @@ is a Right *and* the argument is a Right, in which case it returns

> S.Left('Cannot divide by zero').ap(S.Right(42))
Left("Cannot divide by zero")
Left('Cannot divide by zero')
> S.Right(R.inc).ap(S.Left('Cannot divide by zero'))
Left("Cannot divide by zero")
Left('Cannot divide by zero')

@@ -598,3 +775,3 @@ > S.Right(R.inc).ap(S.Right(42))

<h4 name="Either.prototype.chain"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L934">Either#chain :: Either a b ~> (b -> Either a c) -> Either a c</a></code></h4>
<h4 name="Either.prototype.chain"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1184">Either#chain :: Either a b ~> (b -> Either a c) -> Either a c</a></code></h4>

@@ -605,10 +782,12 @@ Takes a function and returns `this` if `this` is a Left; otherwise

```javascript
> void (sqrt = function(n) { return n < 0 ? S.Left('Cannot represent square root of negative number') : S.Right(Math.sqrt(n)); })
undefined
> global.sqrt = n =>
. n < 0 ? S.Left('Cannot represent square root of negative number')
. : S.Right(Math.sqrt(n))
sqrt
> S.Left('Cannot divide by zero').chain(sqrt)
Left("Cannot divide by zero")
Left('Cannot divide by zero')
> S.Right(-1).chain(sqrt)
Left("Cannot represent square root of negative number")
Left('Cannot represent square root of negative number')

@@ -619,3 +798,3 @@ > S.Right(25).chain(sqrt)

<h4 name="Either.prototype.concat"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L953">Either#concat :: Either a b ~> Either a b -> Either a b</a></code></h4>
<h4 name="Either.prototype.concat"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1212">Either#concat :: (Semigroup a, Semigroup b) => Either a b ~> Either a b -> Either a b</a></code></h4>

@@ -638,3 +817,3 @@ Returns the result of concatenating two Either values of the same type.

> S.Left('abc').concat(S.Left('def'))
Left("abcdef")
Left('abcdef')

@@ -651,3 +830,3 @@ > S.Right([1, 2, 3]).concat(S.Right([4, 5, 6]))

<h4 name="Either.prototype.equals"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L983">Either#equals :: Either a b ~> c -> Boolean</a></code></h4>
<h4 name="Either.prototype.equals"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1251">Either#equals :: Either a b ~> c -> Boolean</a></code></h4>

@@ -673,3 +852,3 @@ Takes a value of any type and returns `true` if:

<h4 name="Either.prototype.extend"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1004">Either#extend :: Either a b ~> (Either a b -> b) -> Either a b</a></code></h4>
<h4 name="Either.prototype.extend"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1280">Either#extend :: Either a b ~> (Either a b -> b) -> Either a b</a></code></h4>

@@ -681,10 +860,10 @@ Takes a function and returns `this` if `this` is a Left; otherwise it

```javascript
> S.Left('Cannot divide by zero').extend(function(x) { return x.value + 1; })
Left("Cannot divide by zero")
> S.Left('Cannot divide by zero').extend(x => x.value + 1)
Left('Cannot divide by zero')
> S.Right(42).extend(function(x) { return x.value + 1; })
> S.Right(42).extend(x => x.value + 1)
Right(43)
```
<h4 name="Either.prototype.map"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1018">Either#map :: Either a b ~> (b -> c) -> Either a c</a></code></h4>
<h4 name="Either.prototype.map"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1301">Either#map :: Either a b ~> (b -> c) -> Either a c</a></code></h4>

@@ -697,3 +876,3 @@ Takes a function and returns `this` if `this` is a Left; otherwise it

> S.Left('Cannot divide by zero').map(R.inc)
Left("Cannot divide by zero")
Left('Cannot divide by zero')

@@ -704,3 +883,3 @@ > S.Right([1, 2, 3]).map(R.sum)

<h4 name="Either.prototype.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1032">Either#of :: Either a b ~> b -> Either a b</a></code></h4>
<h4 name="Either.prototype.of"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1322">Either#of :: Either a b ~> c -> Either a c</a></code></h4>

@@ -714,3 +893,3 @@ Takes a value of any type and returns a Right with the given value.

<h4 name="Either.prototype.toBoolean"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1042">Either#toBoolean :: Either a b ~> Boolean</a></code></h4>
<h4 name="Either.prototype.toBoolean"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1336">Either#toBoolean :: Either a b ~> Boolean</a></code></h4>

@@ -727,3 +906,3 @@ Returns `false` if `this` is a Left; `true` if `this` is a Right.

<h4 name="Either.prototype.toString"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1054">Either#toString :: Either a b ~> String</a></code></h4>
<h4 name="Either.prototype.toString"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1353">Either#toString :: Either a b ~> String</a></code></h4>

@@ -734,16 +913,25 @@ Returns the string representation of the Either.

> S.Left('Cannot divide by zero').toString()
"Left(\\"Cannot divide by zero\\")"
'Left("Cannot divide by zero")'
> S.Right([1, 2, 3]).toString()
"Right([1, 2, 3])"
'Right([1, 2, 3])'
```
<h4 name="Either.prototype.type"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1066">Either#type :: TypeRep Either</a></code></h4>
<h4 name="Either.prototype.inspect"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1373">Either#inspect :: Either a b ~> String</a></code></h4>
A reference to the Either type. Useful for determining whether two
values such as `S.Left('Cannot divide by zero')` and `S.Right(42)`
are of the same type.
Returns the string representation of the Either. This method is used by
`util.inspect` and the REPL to format a Either for display.
<h4 name="Left"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1073">Left :: a -> Either a b</a></code></h4>
See also [`Either#toString`](#Either.prototype.toString).
```javascript
> S.Left('Cannot divide by zero').inspect()
'Left("Cannot divide by zero")'
> S.Right([1, 2, 3]).inspect()
'Right([1, 2, 3])'
```
<h4 name="Left"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1389">Left :: a -> Either a b</a></code></h4>
Takes a value of any type and returns a Left with the given value.

@@ -755,6 +943,6 @@ Though this is a constructor function the `new` keyword needn't be

> S.Left('Cannot divide by zero')
Left("Cannot divide by zero")
Left('Cannot divide by zero')
```
<h4 name="Right"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1121">Right :: b -> Either a b</a></code></h4>
<h4 name="Right"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1407">Right :: b -> Either a b</a></code></h4>

@@ -770,4 +958,28 @@ Takes a value of any type and returns a Right with the given value.

<h4 name="either"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1177">either :: (a -> c) -> (b -> c) -> Either a b -> c</a></code></h4>
<h4 name="isLeft"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1425">isLeft :: Either a b -> Boolean</a></code></h4>
Returns `true` if the given Either is a Left; `false` if it is a Right.
```javascript
> S.isLeft(S.Left('Cannot divide by zero'))
true
> S.isLeft(S.Right(42))
false
```
<h4 name="isRight"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1442">isRight :: Either a b -> Boolean</a></code></h4>
Returns `true` if the given Either is a Right; `false` if it is a Left.
```javascript
> S.isRight(S.Right(42))
true
> S.isRight(S.Left('Cannot divide by zero'))
false
```
<h4 name="either"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1459">either :: (a -> c) -> (b -> c) -> Either a b -> c</a></code></h4>
Takes two functions and an Either, and returns the result of

@@ -780,17 +992,15 @@ applying the first function to the Left's value, if the Either

> S.either(R.toUpper, R.toString, S.Left('Cannot divide by zero'))
"CANNOT DIVIDE BY ZERO"
'CANNOT DIVIDE BY ZERO'
> S.either(R.toUpper, R.toString, S.Right(42))
"42"
'42'
```
<h4 name="encaseEither"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1196">encaseEither :: (Error -> a) -> (* -> b) -> (* -> Either a b)</a></code></h4>
<h4 name="encaseEither"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1481">encaseEither :: (Error -> l) -> (a -> r) -> a -> Either l r</a></code></h4>
Takes two functions, `f` and `g`, the second of which may throw,
and returns a curried function of the same arity as `g` which will
not throw. The result of applying this function is determined by
applying `g` to the same arguments: if this succeeds, the return
value is a Right whose value is the result; otherwise the return
value is a Left whose value is the result of applying `f` to the
caught Error object.
Takes two unary functions, `f` and `g`, the second of which may throw,
and a value `x` of any type. Applies `g` to `x` inside a `try` block.
If an exception is caught, the return value is a Left containing the
result of applying `f` to the caught Error object; otherwise the return
value is a Right containing the result of applying `g` to `x`.

@@ -800,14 +1010,22 @@ See also [`encase`](#encase).

```javascript
> S.encaseEither(R.identity, Array)(0)
Right([])
> S.encaseEither(S.I, JSON.parse, '["foo","bar","baz"]')
Right(['foo', 'bar', 'baz'])
> S.encaseEither(R.identity, Array)(-1)
Left(RangeError: Invalid array length)
> S.encaseEither(S.I, JSON.parse, '[')
Left(new SyntaxError('Unexpected end of input'))
> S.encaseEither(R.prop('message'), Array)(-1)
Left("Invalid array length")
> S.encaseEither(R.prop('message'), JSON.parse, '[')
Left('Unexpected end of input')
```
<h4 name="maybeToEither"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1228">maybeToEither :: a -> Maybe b -> Either a b</a></code></h4>
<h4 name="encaseEither2"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1513">encaseEither2 :: (Error -> l) -> (a -> b -> r) -> a -> b -> Either l r</a></code></h4>
Binary version of [`encaseEither`](#encaseEither).
<h4 name="encaseEither3"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1528">encaseEither3 :: (Error -> l) -> (a -> b -> c -> r) -> a -> b -> c -> Either l r</a></code></h4>
Ternary version of [`encaseEither`](#encaseEither).
<h4 name="maybeToEither"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1543">maybeToEither :: a -> Maybe b -> Either a b</a></code></h4>
Takes a value of any type and a Maybe, and returns an Either.

@@ -820,3 +1038,3 @@ If the second argument is a Nothing, a Left containing the first

> S.maybeToEither('Expecting an integer', S.parseInt(10, 'xyz'))
Left("Expecting an integer")
Left('Expecting an integer')

@@ -827,5 +1045,5 @@ > S.maybeToEither('Expecting an integer', S.parseInt(10, '42'))

### Control
### Alternative
<h4 name="and"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1262">and :: a -> a -> a</a></code></h4>
<h4 name="and"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1593">and :: Alternative a => a -> a -> a</a></code></h4>

@@ -846,3 +1064,3 @@ Takes two values of the same type and returns the second value

<h4 name="or"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1281">or :: a -> a -> a</a></code></h4>
<h4 name="or"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1614">or :: Alternative a => a -> a -> a</a></code></h4>

@@ -862,3 +1080,3 @@ Takes two values of the same type and returns the first value if it

<h4 name="xor"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1299">xor :: a -> a -> a</a></code></h4>
<h4 name="xor"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1634">xor :: (Alternative a, Monoid a) => a -> a -> a</a></code></h4>

@@ -880,5 +1098,66 @@ Takes two values of the same type and returns the "true" value

### Logic
<h4 name="not"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1660">not :: Boolean -> Boolean</a></code></h4>
Takes a Boolean and returns the negation of that value
(`false` for `true`; `true` for `false`).
```javascript
> S.not(true)
false
> S.not(false)
true
```
<h4 name="ifElse"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1678">ifElse :: (a -> Boolean) -> (a -> b) -> (a -> b) -> a -> b</a></code></h4>
Takes a unary predicate, a unary "if" function, a unary "else"
function, and a value of any type, and returns the result of
applying the "if" function to the value if the value satisfies
the predicate; the result of applying the "else" function to the
value otherwise.
```javascript
> S.ifElse(x => x < 0, Math.abs, Math.sqrt, -1)
1
> S.ifElse(x => x < 0, Math.abs, Math.sqrt, 16)
4
```
<h4 name="allPass"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1699">allPass :: [a -> Boolean] -> a -> Boolean</a></code></h4>
Takes an array of unary predicates and a value of any type
and returns `true` if all the predicates pass; `false` otherwise.
None of the subsequent predicates will be evaluated after the
first failed predicate.
```javascript
> S.allPass([S.test(/q/), S.test(/u/), S.test(/i/)], 'quiessence')
true
> S.allPass([S.test(/q/), S.test(/u/), S.test(/i/)], 'fissiparous')
false
```
<h4 name="anyPass"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1724">anyPass :: [a -> Boolean] -> a -> Boolean</a></code></h4>
Takes an array of unary predicates and a value of any type
and returns `true` if any of the predicates pass; `false` otherwise.
None of the subsequent predicates will be evaluated after the
first passed predicate.
```javascript
> S.anyPass([S.test(/q/), S.test(/u/), S.test(/i/)], 'incandescent')
true
> S.anyPass([S.test(/q/), S.test(/u/), S.test(/i/)], 'empathy')
false
```
### List
<h4 name="slice"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1324">slice :: Integer -> Integer -> [a] -> Maybe [a]</a></code></h4>
<h4 name="slice"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1751">slice :: Integer -> Integer -> [a] -> Maybe [a]</a></code></h4>

@@ -897,9 +1176,9 @@ Returns Just a list containing the elements from the supplied list

> S.slice(1, 3, ['a', 'b', 'c', 'd', 'e'])
Just(["b", "c"])
Just(['b', 'c'])
> S.slice(-2, -0, ['a', 'b', 'c', 'd', 'e'])
Just(["d", "e"])
Just(['d', 'e'])
> S.slice(2, -0, ['a', 'b', 'c', 'd', 'e'])
Just(["c", "d", "e"])
Just(['c', 'd', 'e'])

@@ -910,6 +1189,6 @@ > S.slice(1, 6, ['a', 'b', 'c', 'd', 'e'])

> S.slice(2, 6, 'banana')
Just("nana")
Just('nana')
```
<h4 name="at"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1363">at :: Integer -> [a] -> Maybe a</a></code></h4>
<h4 name="at"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1793">at :: Integer -> [a] -> Maybe a</a></code></h4>

@@ -922,3 +1201,3 @@ Takes an index and a list and returns Just the element of the list at

> S.at(2, ['a', 'b', 'c', 'd', 'e'])
Just("c")
Just('c')

@@ -929,6 +1208,6 @@ > S.at(5, ['a', 'b', 'c', 'd', 'e'])

> S.at(-2, ['a', 'b', 'c', 'd', 'e'])
Just("d")
Just('d')
```
<h4 name="head"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1383">head :: [a] -> Maybe a</a></code></h4>
<h4 name="head"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1817">head :: [a] -> Maybe a</a></code></h4>

@@ -946,3 +1225,3 @@ Takes a list and returns Just the first element of the list if the

<h4 name="last"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1397">last :: [a] -> Maybe a</a></code></h4>
<h4 name="last"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1835">last :: [a] -> Maybe a</a></code></h4>

@@ -960,3 +1239,3 @@ Takes a list and returns Just the last element of the list if the

<h4 name="tail"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1411">tail :: [a] -> Maybe [a]</a></code></h4>
<h4 name="tail"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1853">tail :: [a] -> Maybe [a]</a></code></h4>

@@ -975,3 +1254,3 @@ Takes a list and returns Just a list containing all but the first

<h4 name="init"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1426">init :: [a] -> Maybe [a]</a></code></h4>
<h4 name="init"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1872">init :: [a] -> Maybe [a]</a></code></h4>

@@ -990,3 +1269,3 @@ Takes a list and returns Just a list containing all but the last

<h4 name="take"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1441">take :: Integer -> [a] -> Maybe [a]</a></code></h4>
<h4 name="take"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1891">take :: Integer -> [a] -> Maybe [a]</a></code></h4>

@@ -1000,6 +1279,6 @@ Returns Just the first N elements of the given collection if N is

> S.take(2, ['a', 'b', 'c', 'd', 'e'])
Just(["a", "b"])
Just(['a', 'b'])
> S.take(4, 'abcdefg')
Just("abcd")
Just('abcd')

@@ -1010,3 +1289,3 @@ > S.take(4, ['a', 'b', 'c'])

<h4 name="takeLast"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1462">takeLast :: Integer -> [a] -> Maybe [a]</a></code></h4>
<h4 name="takeLast"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1916">takeLast :: Integer -> [a] -> Maybe [a]</a></code></h4>

@@ -1020,6 +1299,6 @@ Returns Just the last N elements of the given collection if N is

> S.takeLast(2, ['a', 'b', 'c', 'd', 'e'])
Just(["d", "e"])
Just(['d', 'e'])
> S.takeLast(4, 'abcdefg')
Just("defg")
Just('defg')

@@ -1030,3 +1309,3 @@ > S.takeLast(4, ['a', 'b', 'c'])

<h4 name="drop"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1483">drop :: Integer -> [a] -> Maybe [a]</a></code></h4>
<h4 name="drop"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1941">drop :: Integer -> [a] -> Maybe [a]</a></code></h4>

@@ -1040,6 +1319,6 @@ Returns Just all but the first N elements of the given collection

> S.drop(2, ['a', 'b', 'c', 'd', 'e'])
Just(["c", "d", "e"])
Just(['c', 'd', 'e'])
> S.drop(4, 'abcdefg')
Just("efg")
Just('efg')

@@ -1050,3 +1329,3 @@ > S.drop(4, 'abc')

<h4 name="dropLast"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1504">dropLast :: Integer -> [a] -> Maybe [a]</a></code></h4>
<h4 name="dropLast"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1966">dropLast :: Integer -> [a] -> Maybe [a]</a></code></h4>

@@ -1060,6 +1339,6 @@ Returns Just all but the last N elements of the given collection

> S.dropLast(2, ['a', 'b', 'c', 'd', 'e'])
Just(["a", "b", "c"])
Just(['a', 'b', 'c'])
> S.dropLast(4, 'abcdefg')
Just("abc")
Just('abc')

@@ -1070,3 +1349,3 @@ > S.dropLast(4, 'abc')

<h4 name="find"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1525">find :: (a -> Boolean) -> [a] -> Maybe a</a></code></h4>
<h4 name="find"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L1991">find :: (a -> Boolean) -> [a] -> Maybe a</a></code></h4>

@@ -1078,10 +1357,10 @@ Takes a predicate and a list and returns Just the leftmost element of

```javascript
> S.find(function(n) { return n < 0; }, [1, -2, 3, -4, 5])
> S.find(n => n < 0, [1, -2, 3, -4, 5])
Just(-2)
> S.find(function(n) { return n < 0; }, [1, 2, 3, 4, 5])
> S.find(n => n < 0, [1, 2, 3, 4, 5])
Nothing()
```
<h4 name="indexOf"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1551">indexOf :: a -> [a] -> Maybe Integer</a></code></h4>
<h4 name="indexOf"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2034">indexOf :: a -> [a] -> Maybe Integer</a></code></h4>

@@ -1110,3 +1389,3 @@ Takes a value of any type and a list, and returns Just the index

<h4 name="lastIndexOf"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1576">lastIndexOf :: a -> [a] -> Maybe Integer</a></code></h4>
<h4 name="lastIndexOf"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2059">lastIndexOf :: a -> [a] -> Maybe Integer</a></code></h4>

@@ -1135,3 +1414,3 @@ Takes a value of any type and a list, and returns Just the index

<h4 name="pluck"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1601">pluck :: TypeRep a -> String -> [Accessible] -> [Maybe a]</a></code></h4>
<h4 name="pluck"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2084">pluck :: Accessible a => TypeRep b -> String -> [a] -> [Maybe b]</a></code></h4>

@@ -1151,5 +1430,22 @@ Takes a [type representative](#type-representatives), a property name,

<h4 name="unfoldr"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2104">unfoldr :: (b -> Maybe (a, b)) -> b -> [a]</a></code></h4>
Takes a function and a seed value, and returns a list generated by
applying the function repeatedly. The list is initially empty. The
function is initially applied to the seed value. Each application
of the function should result in either:
- a Nothing, in which case the list is returned; or
- Just a pair, in which case the first element is appended to
the list and the function is applied to the second element.
```javascript
> S.unfoldr(n => n < 5 ? S.Just([n, n + 1]) : S.Nothing(), 1)
[1, 2, 3, 4]
```
### Object
<h4 name="get"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1621">get :: TypeRep a -> String -> Accessible -> Maybe a</a></code></h4>
<h4 name="get"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2136">get :: Accessible a => TypeRep b -> String -> a -> Maybe b</a></code></h4>

@@ -1177,3 +1473,3 @@ Takes a [type representative](#type-representatives), a property

<h4 name="gets"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1648">gets :: TypeRep a -> [String] -> Accessible -> Maybe a</a></code></h4>
<h4 name="gets"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2164">gets :: Accessible a => TypeRep b -> [String] -> a -> Maybe b</a></code></h4>

@@ -1200,3 +1496,3 @@ Takes a [type representative](#type-representatives), a list of property

<h4 name="parseDate"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1674">parseDate :: String -> Maybe Date</a></code></h4>
<h4 name="parseDate"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2200">parseDate :: String -> Maybe Date</a></code></h4>

@@ -1208,3 +1504,3 @@ Takes a string and returns Just the date represented by the string

> S.parseDate('2011-01-19T17:40:00Z')
Just(new Date("2011-01-19T17:40:00.000Z"))
Just(new Date('2011-01-19T17:40:00.000Z'))

@@ -1215,3 +1511,3 @@ > S.parseDate('today')

<h4 name="parseFloat"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1725">parseFloat :: String -> Maybe Number</a></code></h4>
<h4 name="parseFloat"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2255">parseFloat :: String -> Maybe Number</a></code></h4>

@@ -1229,3 +1525,3 @@ Takes a string and returns Just the number represented by the string

<h4 name="parseInt"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1741">parseInt :: Integer -> String -> Maybe Integer</a></code></h4>
<h4 name="parseInt"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2273">parseInt :: Integer -> String -> Maybe Integer</a></code></h4>

@@ -1252,3 +1548,3 @@ Takes a radix (an integer between 2 and 36 inclusive) and a string,

<h4 name="parseJson"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1782">parseJson :: String -> Maybe *</a></code></h4>
<h4 name="parseJson"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2318">parseJson :: String -> Maybe Any</a></code></h4>

@@ -1261,3 +1557,3 @@ Takes a string which may or may not be valid JSON, and returns Just

> S.parseJson('["foo","bar","baz"]')
Just(["foo", "bar", "baz"])
Just(['foo', 'bar', 'baz'])

@@ -1270,4 +1566,40 @@ > S.parseJson('[')

<h4 name="match"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1801">match :: RegExp -> String -> Maybe [Maybe String]</a></code></h4>
<h4 name="regex"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2339">regex :: RegexFlags -> String -> RegExp</a></code></h4>
Takes a [RegexFlags][] and a pattern, and returns a RegExp.
```javascript
> S.regex('g', ':\\d+:')
/:\d+:/g
```
<h4 name="regexEscape"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2353">regexEscape :: String -> String</a></code></h4>
Takes a string which may contain regular expression metacharacters,
and returns a string with those metacharacters escaped.
Properties:
- `forall s :: String. S.test(S.regex('', S.regexEscape(s)), s) = true`
```javascript
> S.regexEscape('-=*{XYZ}*=-')
'\\-=\\*\\{XYZ\\}\\*=\\-'
```
<h4 name="test"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2372">test :: RegExp -> String -> Boolean</a></code></h4>
Takes a pattern and a string, and returns `true` if the pattern
matches the string; `false` otherwise.
```javascript
> S.test(/^a/, 'abacus')
true
> S.test(/^a/, 'banana')
false
```
<h4 name="match"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2395">match :: RegExp -> String -> Maybe [Maybe String]</a></code></h4>
Takes a pattern and a string, and returns Just a list of matches

@@ -1280,6 +1612,6 @@ if the pattern matches the string; Nothing otherwise. Each match

> S.match(/(good)?bye/, 'goodbye')
Just([Just("goodbye"), Just("good")])
Just([Just('goodbye'), Just('good')])
> S.match(/(good)?bye/, 'bye')
Just([Just("bye"), Nothing()])
Just([Just('bye'), Nothing()])
```

@@ -1289,3 +1621,3 @@

<h4 name="words"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1821">words :: String -> [String]</a></code></h4>
<h4 name="words"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2419">words :: String -> [String]</a></code></h4>

@@ -1299,6 +1631,6 @@ Takes a string and returns the list of words the string contains

> S.words(' foo bar baz ')
["foo", "bar", "baz"]
['foo', 'bar', 'baz']
```
<h4 name="unwords"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1835">unwords :: [String] -> String</a></code></h4>
<h4 name="unwords"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2436">unwords :: [String] -> String</a></code></h4>

@@ -1312,6 +1644,6 @@ Takes a list of words and returns the result of joining the words

> S.unwords(['foo', 'bar', 'baz'])
"foo bar baz"
'foo bar baz'
```
<h4 name="lines"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1848">lines :: String -> [String]</a></code></h4>
<h4 name="lines"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2453">lines :: String -> [String]</a></code></h4>

@@ -1326,6 +1658,6 @@ Takes a string and returns the list of lines the string contains

> S.lines('foo\nbar\nbaz\n')
["foo", "bar", "baz"]
['foo', 'bar', 'baz']
```
<h4 name="unlines"><code><a href="https://github.com/plaid/sanctuary/blob/v0.7.1/index.js#L1864">unlines :: [String] -> String</a></code></h4>
<h4 name="unlines"><code><a href="https://github.com/plaid/sanctuary/blob/v0.8.0/index.js#L2471">unlines :: [String] -> String</a></code></h4>

@@ -1339,15 +1671,18 @@ Takes a list of lines and returns the result of joining the lines

> S.unlines(['foo', 'bar', 'baz'])
"foo\nbar\nbaz\n"
'foo\nbar\nbaz\n'
```
[Apply]: https://github.com/fantasyland/fantasy-land#apply
[Extend]: https://github.com/fantasyland/fantasy-land#extend
[Foldable]: https://github.com/fantasyland/fantasy-land#foldable
[Functor]: https://github.com/fantasyland/fantasy-land#functor
[Monad]: https://github.com/fantasyland/fantasy-land#monad
[Monoid]: https://github.com/fantasyland/fantasy-land#monoid
[R.equals]: http://ramdajs.com/docs/#equals
[R.is]: http://ramdajs.com/docs/#is
[R.map]: http://ramdajs.com/docs/#map
[R.type]: http://ramdajs.com/docs/#type
[Ramda]: http://ramdajs.com/
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
[RegexFlags]: https://github.com/plaid/sanctuary-def#regexflags
[Semigroup]: https://github.com/fantasyland/fantasy-land#semigroup
[parseInt]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
[primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive

Sorry, the diff of this file is too big to display

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