UNPKG

lodash-fantasy

Version:

Fantasy Land compatible types built with lodash.

1,813 lines (808 loc) 81.5 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Lodash Fantasy</title> <meta name="description" content="Fantasy Land compatible types built with lodash." /> <meta property="og:title" content=""/> <meta property="og:type" content="website"/> <meta property="og:image" content=""/> <meta property="og:url" content=""/> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <script src="scripts/jquery.min.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="styles/jaguar.css"> <script> var config = {"monospaceLinks":true,"cleverLinks":false,"applicationName":"lodash-fantasy","collapseSymbols":false,"default":{"outputSourceFiles":true},"linenums":true,"meta":{"description":"Fantasy Land compatible types built with lodash.","title":"Lodash Fantasy"},"openGraph":{"type":"website"}}; </script> </head> <body> <div id="wrap" class="clearfix"> <div class="navigation"> <h3 class="applicationName"><a href="index.html">lodash-fantasy</a></h3> <div class="search"> <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations"> </div> <ul class="list"> <li class="item" data-name="Either"> <span class="title"> <a href="Either.html">Either</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Either.all"><a href="Either.html#.all">all</a></li> <li data-name="Either.any"><a href="Either.html#.any">any</a></li> <li data-name="Either.each"><a href="Either.html#.each">each</a></li> <li data-name="Either.equals"><a href="Either.html#.equals">equals</a></li> <li data-name="Either.filter"><a href="Either.html#.filter">filter</a></li> <li data-name="Either.from"><a href="Either.html#.from">from</a></li> <li data-name="Either.isEither"><a href="Either.html#.isEither">isEither</a></li> <li data-name="Either.isLeft"><a href="Either.html#.isLeft">isLeft</a></li> <li data-name="Either.isRight"><a href="Either.html#.isRight">isRight</a></li> <li data-name="Either.Left"><a href="Either.html#.Left">Left</a></li> <li data-name="Either.map"><a href="Either.html#.map">map</a></li> <li data-name="Either.mapIn"><a href="Either.html#.mapIn">mapIn</a></li> <li data-name="Either.of"><a href="Either.html#.of">of</a></li> <li data-name="Either.reduce"><a href="Either.html#.reduce">reduce</a></li> <li data-name="Either.Right"><a href="Either.html#.Right">Right</a></li> <li data-name="Either.toMaybe"><a href="Either.html#.toMaybe">toMaybe</a></li> <li data-name="Either.toPromise"><a href="Either.html#.toPromise">toPromise</a></li> <li data-name="Either.toValidation"><a href="Either.html#.toValidation">toValidation</a></li> <li data-name="Either.try"><a href="Either.html#.try">try</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Either#ap"><a href="Either.html#ap">ap</a></li> <li data-name="Either#bimap"><a href="Either.html#bimap">bimap</a></li> <li data-name="Either#chain"><a href="Either.html#chain">chain</a></li> <li data-name="Either#equals"><a href="Either.html#equals">equals</a></li> <li data-name="Either#extend"><a href="Either.html#extend">extend</a></li> <li data-name="Either#get"><a href="Either.html#get">get</a></li> <li data-name="Either#ifLeft"><a href="Either.html#ifLeft">ifLeft</a></li> <li data-name="Either#ifRight"><a href="Either.html#ifRight">ifRight</a></li> <li data-name="Either#isLeft"><a href="Either.html#isLeft">isLeft</a></li> <li data-name="Either#isRight"><a href="Either.html#isRight">isRight</a></li> <li data-name="Either#map"><a href="Either.html#map">map</a></li> <li data-name="Either#of"><a href="Either.html#of">of</a></li> <li data-name="Either#orElse"><a href="Either.html#orElse">orElse</a></li> <li data-name="Either#orElseGet"><a href="Either.html#orElseGet">orElseGet</a></li> <li data-name="Either#orElseThrow"><a href="Either.html#orElseThrow">orElseThrow</a></li> <li data-name="Either#toMaybe"><a href="Either.html#toMaybe">toMaybe</a></li> <li data-name="Either#toPromise"><a href="Either.html#toPromise">toPromise</a></li> <li data-name="Either#toString"><a href="Either.html#toString">toString</a></li> <li data-name="Either#toValidation"><a href="Either.html#toValidation">toValidation</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Failure"> <span class="title"> <a href="Failure.html">Failure</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Failure.from"><a href="Failure.html#.from">from</a></li> <li data-name="Failure#ap"><a href="Failure.html#ap">ap</a></li> <li data-name="Failure#bimap"><a href="Failure.html#bimap">bimap</a></li> <li data-name="Failure#chain"><a href="Failure.html#chain">chain</a></li> <li data-name="Failure#concat"><a href="Failure.html#concat">concat</a></li> <li data-name="Failure#equals"><a href="Failure.html#equals">equals</a></li> <li data-name="Failure#extend"><a href="Failure.html#extend">extend</a></li> <li data-name="Failure#ifFailure"><a href="Failure.html#ifFailure">ifFailure</a></li> <li data-name="Failure#ifSuccess"><a href="Failure.html#ifSuccess">ifSuccess</a></li> <li data-name="Failure#isFailure"><a href="Failure.html#isFailure">isFailure</a></li> <li data-name="Failure#isSuccess"><a href="Failure.html#isSuccess">isSuccess</a></li> <li data-name="Failure#map"><a href="Failure.html#map">map</a></li> <li data-name="Failure#of"><a href="Failure.html#of">of</a></li> <li data-name="Failure#orElse"><a href="Failure.html#orElse">orElse</a></li> <li data-name="Failure#orElseGet"><a href="Failure.html#orElseGet">orElseGet</a></li> <li data-name="Failure#orElseThrow"><a href="Failure.html#orElseThrow">orElseThrow</a></li> <li data-name="Failure#toEither"><a href="Failure.html#toEither">toEither</a></li> <li data-name="Failure#toMaybe"><a href="Failure.html#toMaybe">toMaybe</a></li> <li data-name="Failure#toPromise"><a href="Failure.html#toPromise">toPromise</a></li> <li data-name="Failure#toString"><a href="Failure.html#toString">toString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Just"> <span class="title"> <a href="Just.html">Just</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Just.from"><a href="Just.html#.from">from</a></li> <li data-name="Just#ap"><a href="Just.html#ap">ap</a></li> <li data-name="Just#chain"><a href="Just.html#chain">chain</a></li> <li data-name="Just#equals"><a href="Just.html#equals">equals</a></li> <li data-name="Just#extend"><a href="Just.html#extend">extend</a></li> <li data-name="Just#get"><a href="Just.html#get">get</a></li> <li data-name="Just#ifJust"><a href="Just.html#ifJust">ifJust</a></li> <li data-name="Just#ifNothing"><a href="Just.html#ifNothing">ifNothing</a></li> <li data-name="Just#isJust"><a href="Just.html#isJust">isJust</a></li> <li data-name="Just#isNothing"><a href="Just.html#isNothing">isNothing</a></li> <li data-name="Just#map"><a href="Just.html#map">map</a></li> <li data-name="Just#of"><a href="Just.html#of">of</a></li> <li data-name="Just#orElse"><a href="Just.html#orElse">orElse</a></li> <li data-name="Just#orElseGet"><a href="Just.html#orElseGet">orElseGet</a></li> <li data-name="Just#orElseThrow"><a href="Just.html#orElseThrow">orElseThrow</a></li> <li data-name="Just#toEither"><a href="Just.html#toEither">toEither</a></li> <li data-name="Just#toPromise"><a href="Just.html#toPromise">toPromise</a></li> <li data-name="Just#toString"><a href="Just.html#toString">toString</a></li> <li data-name="Just#toValidation"><a href="Just.html#toValidation">toValidation</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Left"> <span class="title"> <a href="Left.html">Left</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Left.from"><a href="Left.html#.from">from</a></li> <li data-name="Left#ap"><a href="Left.html#ap">ap</a></li> <li data-name="Left#bimap"><a href="Left.html#bimap">bimap</a></li> <li data-name="Left#chain"><a href="Left.html#chain">chain</a></li> <li data-name="Left#equals"><a href="Left.html#equals">equals</a></li> <li data-name="Left#extend"><a href="Left.html#extend">extend</a></li> <li data-name="Left#get"><a href="Left.html#get">get</a></li> <li data-name="Left#ifLeft"><a href="Left.html#ifLeft">ifLeft</a></li> <li data-name="Left#ifRight"><a href="Left.html#ifRight">ifRight</a></li> <li data-name="Left#isLeft"><a href="Left.html#isLeft">isLeft</a></li> <li data-name="Left#isRight"><a href="Left.html#isRight">isRight</a></li> <li data-name="Left#map"><a href="Left.html#map">map</a></li> <li data-name="Left#of"><a href="Left.html#of">of</a></li> <li data-name="Left#orElse"><a href="Left.html#orElse">orElse</a></li> <li data-name="Left#orElseGet"><a href="Left.html#orElseGet">orElseGet</a></li> <li data-name="Left#orElseThrow"><a href="Left.html#orElseThrow">orElseThrow</a></li> <li data-name="Left#toMaybe"><a href="Left.html#toMaybe">toMaybe</a></li> <li data-name="Left#toPromise"><a href="Left.html#toPromise">toPromise</a></li> <li data-name="Left#toString"><a href="Left.html#toString">toString</a></li> <li data-name="Left#toValidation"><a href="Left.html#toValidation">toValidation</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Maybe"> <span class="title"> <a href="Maybe.html">Maybe</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Maybe.all"><a href="Maybe.html#.all">all</a></li> <li data-name="Maybe.any"><a href="Maybe.html#.any">any</a></li> <li data-name="Maybe.each"><a href="Maybe.html#.each">each</a></li> <li data-name="Maybe.equals"><a href="Maybe.html#.equals">equals</a></li> <li data-name="Maybe.filter"><a href="Maybe.html#.filter">filter</a></li> <li data-name="Maybe.from"><a href="Maybe.html#.from">from</a></li> <li data-name="Maybe.isJust"><a href="Maybe.html#.isJust">isJust</a></li> <li data-name="Maybe.isMaybe"><a href="Maybe.html#.isMaybe">isMaybe</a></li> <li data-name="Maybe.isNothing"><a href="Maybe.html#.isNothing">isNothing</a></li> <li data-name="Maybe.Just"><a href="Maybe.html#.Just">Just</a></li> <li data-name="Maybe.map"><a href="Maybe.html#.map">map</a></li> <li data-name="Maybe.mapIn"><a href="Maybe.html#.mapIn">mapIn</a></li> <li data-name="Maybe.Nothing"><a href="Maybe.html#.Nothing">Nothing</a></li> <li data-name="Maybe.of"><a href="Maybe.html#.of">of</a></li> <li data-name="Maybe.ofNullable"><a href="Maybe.html#.ofNullable">ofNullable</a></li> <li data-name="Maybe.reduce"><a href="Maybe.html#.reduce">reduce</a></li> <li data-name="Maybe.toEither"><a href="Maybe.html#.toEither">toEither</a></li> <li data-name="Maybe.toPromise"><a href="Maybe.html#.toPromise">toPromise</a></li> <li data-name="Maybe.toValidation"><a href="Maybe.html#.toValidation">toValidation</a></li> <li data-name="Maybe.try"><a href="Maybe.html#.try">try</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Maybe#ap"><a href="Maybe.html#ap">ap</a></li> <li data-name="Maybe#chain"><a href="Maybe.html#chain">chain</a></li> <li data-name="Maybe#equals"><a href="Maybe.html#equals">equals</a></li> <li data-name="Maybe#extend"><a href="Maybe.html#extend">extend</a></li> <li data-name="Maybe#get"><a href="Maybe.html#get">get</a></li> <li data-name="Maybe#ifJust"><a href="Maybe.html#ifJust">ifJust</a></li> <li data-name="Maybe#ifNothing"><a href="Maybe.html#ifNothing">ifNothing</a></li> <li data-name="Maybe#isJust"><a href="Maybe.html#isJust">isJust</a></li> <li data-name="Maybe#isNothing"><a href="Maybe.html#isNothing">isNothing</a></li> <li data-name="Maybe#map"><a href="Maybe.html#map">map</a></li> <li data-name="Maybe#of"><a href="Maybe.html#of">of</a></li> <li data-name="Maybe#orElse"><a href="Maybe.html#orElse">orElse</a></li> <li data-name="Maybe#orElseGet"><a href="Maybe.html#orElseGet">orElseGet</a></li> <li data-name="Maybe#orElseThrow"><a href="Maybe.html#orElseThrow">orElseThrow</a></li> <li data-name="Maybe#toEither"><a href="Maybe.html#toEither">toEither</a></li> <li data-name="Maybe#toPromise"><a href="Maybe.html#toPromise">toPromise</a></li> <li data-name="Maybe#toString"><a href="Maybe.html#toString">toString</a></li> <li data-name="Maybe#toValidation"><a href="Maybe.html#toValidation">toValidation</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Nothing"> <span class="title"> <a href="Nothing.html">Nothing</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Nothing.from"><a href="Nothing.html#.from">from</a></li> <li data-name="Nothing#ap"><a href="Nothing.html#ap">ap</a></li> <li data-name="Nothing#chain"><a href="Nothing.html#chain">chain</a></li> <li data-name="Nothing#equals"><a href="Nothing.html#equals">equals</a></li> <li data-name="Nothing#extend"><a href="Nothing.html#extend">extend</a></li> <li data-name="Nothing#get"><a href="Nothing.html#get">get</a></li> <li data-name="Nothing#ifJust"><a href="Nothing.html#ifJust">ifJust</a></li> <li data-name="Nothing#ifNothing"><a href="Nothing.html#ifNothing">ifNothing</a></li> <li data-name="Nothing#isJust"><a href="Nothing.html#isJust">isJust</a></li> <li data-name="Nothing#isNothing"><a href="Nothing.html#isNothing">isNothing</a></li> <li data-name="Nothing#map"><a href="Nothing.html#map">map</a></li> <li data-name="Nothing#of"><a href="Nothing.html#of">of</a></li> <li data-name="Nothing#orElse"><a href="Nothing.html#orElse">orElse</a></li> <li data-name="Nothing#orElseGet"><a href="Nothing.html#orElseGet">orElseGet</a></li> <li data-name="Nothing#orElseThrow"><a href="Nothing.html#orElseThrow">orElseThrow</a></li> <li data-name="Nothing#toEither"><a href="Nothing.html#toEither">toEither</a></li> <li data-name="Nothing#toPromise"><a href="Nothing.html#toPromise">toPromise</a></li> <li data-name="Nothing#toString"><a href="Nothing.html#toString">toString</a></li> <li data-name="Nothing#toValidation"><a href="Nothing.html#toValidation">toValidation</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Right"> <span class="title"> <a href="Right.html">Right</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Right.from"><a href="Right.html#.from">from</a></li> <li data-name="Right#ap"><a href="Right.html#ap">ap</a></li> <li data-name="Right#bimap"><a href="Right.html#bimap">bimap</a></li> <li data-name="Right#chain"><a href="Right.html#chain">chain</a></li> <li data-name="Right#equals"><a href="Right.html#equals">equals</a></li> <li data-name="Right#extend"><a href="Right.html#extend">extend</a></li> <li data-name="Right#get"><a href="Right.html#get">get</a></li> <li data-name="Right#ifLeft"><a href="Right.html#ifLeft">ifLeft</a></li> <li data-name="Right#ifRight"><a href="Right.html#ifRight">ifRight</a></li> <li data-name="Right#isLeft"><a href="Right.html#isLeft">isLeft</a></li> <li data-name="Right#isRight"><a href="Right.html#isRight">isRight</a></li> <li data-name="Right#map"><a href="Right.html#map">map</a></li> <li data-name="Right#of"><a href="Right.html#of">of</a></li> <li data-name="Right#orElse"><a href="Right.html#orElse">orElse</a></li> <li data-name="Right#orElseGet"><a href="Right.html#orElseGet">orElseGet</a></li> <li data-name="Right#orElseThrow"><a href="Right.html#orElseThrow">orElseThrow</a></li> <li data-name="Right#toMaybe"><a href="Right.html#toMaybe">toMaybe</a></li> <li data-name="Right#toPromise"><a href="Right.html#toPromise">toPromise</a></li> <li data-name="Right#toString"><a href="Right.html#toString">toString</a></li> <li data-name="Right#toValidation"><a href="Right.html#toValidation">toValidation</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Success"> <span class="title"> <a href="Success.html">Success</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Success.from"><a href="Success.html#.from">from</a></li> <li data-name="Success#ap"><a href="Success.html#ap">ap</a></li> <li data-name="Success#bimap"><a href="Success.html#bimap">bimap</a></li> <li data-name="Success#chain"><a href="Success.html#chain">chain</a></li> <li data-name="Success#concat"><a href="Success.html#concat">concat</a></li> <li data-name="Success#equals"><a href="Success.html#equals">equals</a></li> <li data-name="Success#extend"><a href="Success.html#extend">extend</a></li> <li data-name="Success#ifFailure"><a href="Success.html#ifFailure">ifFailure</a></li> <li data-name="Success#ifSuccess"><a href="Success.html#ifSuccess">ifSuccess</a></li> <li data-name="Success#isFailure"><a href="Success.html#isFailure">isFailure</a></li> <li data-name="Success#isSuccess"><a href="Success.html#isSuccess">isSuccess</a></li> <li data-name="Success#map"><a href="Success.html#map">map</a></li> <li data-name="Success#of"><a href="Success.html#of">of</a></li> <li data-name="Success#orElse"><a href="Success.html#orElse">orElse</a></li> <li data-name="Success#orElseGet"><a href="Success.html#orElseGet">orElseGet</a></li> <li data-name="Success#orElseThrow"><a href="Success.html#orElseThrow">orElseThrow</a></li> <li data-name="Success#toEither"><a href="Success.html#toEither">toEither</a></li> <li data-name="Success#toMaybe"><a href="Success.html#toMaybe">toMaybe</a></li> <li data-name="Success#toPromise"><a href="Success.html#toPromise">toPromise</a></li> <li data-name="Success#toString"><a href="Success.html#toString">toString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Validation"> <span class="title"> <a href="Validation.html">Validation</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Validation.all"><a href="Validation.html#.all">all</a></li> <li data-name="Validation.any"><a href="Validation.html#.any">any</a></li> <li data-name="Validation.concat"><a href="Validation.html#.concat">concat</a></li> <li data-name="Validation.each"><a href="Validation.html#.each">each</a></li> <li data-name="Validation.empty"><a href="Validation.html#.empty">empty</a></li> <li data-name="Validation.equals"><a href="Validation.html#.equals">equals</a></li> <li data-name="Validation.Failure"><a href="Validation.html#.Failure">Failure</a></li> <li data-name="Validation.filter"><a href="Validation.html#.filter">filter</a></li> <li data-name="Validation.from"><a href="Validation.html#.from">from</a></li> <li data-name="Validation.isFailure"><a href="Validation.html#.isFailure">isFailure</a></li> <li data-name="Validation.isSuccess"><a href="Validation.html#.isSuccess">isSuccess</a></li> <li data-name="Validation.isValidation"><a href="Validation.html#.isValidation">isValidation</a></li> <li data-name="Validation.map"><a href="Validation.html#.map">map</a></li> <li data-name="Validation.mapIn"><a href="Validation.html#.mapIn">mapIn</a></li> <li data-name="Validation.of"><a href="Validation.html#.of">of</a></li> <li data-name="Validation.reduce"><a href="Validation.html#.reduce">reduce</a></li> <li data-name="Validation.Success"><a href="Validation.html#.Success">Success</a></li> <li data-name="Validation.toEither"><a href="Validation.html#.toEither">toEither</a></li> <li data-name="Validation.toMaybe"><a href="Validation.html#.toMaybe">toMaybe</a></li> <li data-name="Validation.toPromise"><a href="Validation.html#.toPromise">toPromise</a></li> <li data-name="Validation.try"><a href="Validation.html#.try">try</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Validation#ap"><a href="Validation.html#ap">ap</a></li> <li data-name="Validation#bimap"><a href="Validation.html#bimap">bimap</a></li> <li data-name="Validation#chain"><a href="Validation.html#chain">chain</a></li> <li data-name="Validation#concat"><a href="Validation.html#concat">concat</a></li> <li data-name="Validation#equals"><a href="Validation.html#equals">equals</a></li> <li data-name="Validation#extend"><a href="Validation.html#extend">extend</a></li> <li data-name="Validation#ifFailure"><a href="Validation.html#ifFailure">ifFailure</a></li> <li data-name="Validation#ifSuccess"><a href="Validation.html#ifSuccess">ifSuccess</a></li> <li data-name="Validation#isFailure"><a href="Validation.html#isFailure">isFailure</a></li> <li data-name="Validation#isSuccess"><a href="Validation.html#isSuccess">isSuccess</a></li> <li data-name="Validation#map"><a href="Validation.html#map">map</a></li> <li data-name="Validation#of"><a href="Validation.html#of">of</a></li> <li data-name="Validation#orElse"><a href="Validation.html#orElse">orElse</a></li> <li data-name="Validation#orElseGet"><a href="Validation.html#orElseGet">orElseGet</a></li> <li data-name="Validation#orElseThrow"><a href="Validation.html#orElseThrow">orElseThrow</a></li> <li data-name="Validation#toEither"><a href="Validation.html#toEither">toEither</a></li> <li data-name="Validation#toMaybe"><a href="Validation.html#toMaybe">toMaybe</a></li> <li data-name="Validation#toPromise"><a href="Validation.html#toPromise">toPromise</a></li> <li data-name="Validation#toString"><a href="Validation.html#toString">toString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> </ul> </div> <div class="main"> <h1 class="page-title" data-filename="Just.html">Class: Just</h1> <section> <header> <h2> Just </h2> </header> <article> <div class="container-overview"> <dt> <div class="nameContainer"> <h4 class="name" id="Just"> new Just<span class="signature">()</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line890">line 890</a> </div> </div> </dt> <dd> <dl class="details"> </dl> </dd> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="Maybe.html">Maybe</a></li> </ul> <h3 class="subsection-title">Methods</h3> <dl> <dt> <div class="nameContainer"> <h4 class="name" id=".from"> <span class="type-signature static">static</span>Just.from<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Maybe.html">Maybe</a>}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line919">line 919</a> </div> </div> </dt> <dd> <div class="description"> Creates a new <a href="Just.html"><code>Just</code></a> from a <code>value</code>. If the <code>value</code> is already a <a href="Maybe.html"><code>Maybe</code></a> instance, the <code>value</code> is returned unchanged. Otherwise, a new <a href="Just.html"><code>Just</code></a> is made with the <code>value</code>. </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"> Value to wrap in a <a href="Just.html"><code>Just</code></a>.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <a href="Maybe.html">Maybe</a> </td> <td class="description last"><a href="Maybe.html"><code>Maybe</code></a> when is the <code>value</code> already wrapped or <a href="Just.html"><code>Just</code></a> wrapped <code>value</code>.</td> </tr> </tbody> </table> <h5>Examples</h5> <p class="code-caption">Just from nothing</p> <pre class="prettyprint"><code>Just.from(); // => Just()</code></pre> <p class="code-caption">Just from arbitrary value</p> <pre class="prettyprint"><code>Just.from(true); // => Just(true)</code></pre> <p class="code-caption">Just from another Just</p> <pre class="prettyprint"><code>Just.from(Just.from(value)); // => Just(value)</code></pre> <p class="code-caption">Just from Nothing</p> <pre class="prettyprint"><code>Just.from(Nothing.from()); // => Nothing()</code></pre> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="ap"> <span class="inherited"><a href="Maybe.html#ap">inherited</a></span> <span class="type-signature ">abstract</span>ap<span class="signature">(other)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Maybe.html">Maybe</a>}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line315">line 315</a> </div> </div> </dt> <dd> <div class="description"> Applies the function contained in the instance of a <a href="Just.html"><code>Just</code></a> to the value contained in the provided <a href="Just.html"><code>Just</code></a>, producing a <a href="Just.html"><code>Just</code></a> containing the result. If the instance is a <a href="Nothing.html"><code>Nothing</code></a>, the result is the <a href="Nothing.html"><code>Nothing</code></a> instance. If the instance is a <a href="Just.html"><code>Just</code></a> and the provided <a href="Maybe.html"><code>Maybe</code></a> is <a href="Nothing.html"><code>Nothing</code></a>, the result is the provided <a href="Nothing.html"><code>Nothing</code></a>. </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>other</code></td> <td class="type"> <span class="param-type"><a href="Maybe.html">Maybe</a></span> </td> <td class="description last"> Value to apply to the function wrapped in the <a href="Just.html"><code>Just</code></a>.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <a href="Maybe.html">Maybe</a> </td> <td class="description last"><a href="Just.html"><code>Just</code></a> wrapped applied function or <a href="Nothing.html"><code>Nothing</code></a>.</td> </tr> </tbody> </table> <h5>Example</h5> <p class="code-caption">Just#ap</p> <pre class="prettyprint"><code>const findPerson = curryN(3, Person.find); // Person.find(name, birthdate, address) Just.from(findPerson) // => Just(findPerson) .ap(Just.ofNullable(name)) // => Just(name) .ap(Just.ofNullable(birthdate)) // => Just(birthdate) .ap(Just.ofNullable(address)) // => Just(address) .ifJust(console.log); // => Log Person.find() response</code></pre> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="chain"> <span class="inherited"><a href="Maybe.html#chain">inherited</a></span> <span class="type-signature ">abstract</span>chain<span class="signature">(method)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Maybe.html">Maybe</a>}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line337">line 337</a> </div> </div> </dt> <dd> <div class="description"> Applies the provided function to the value contained for a <a href="Just.html"><code>Just</code></a>. The function should return the value wrapped in a <a href="Maybe.html"><code>Maybe</code></a>. If the instance is a <a href="Nothing.html"><code>Nothing</code></a>, the function is ignored and then instance is returned unchanged. </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>method</code></td> <td class="type"> <span class="param-type"><a href="global.html#Chain">Chain</a>.&lt;<a href="Maybe.html">Maybe</a>></span> </td> <td class="description last"> The function to invoke with the value.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <a href="Maybe.html">Maybe</a> </td> <td class="description last"><a href="Maybe.html"><code>Maybe</code></a> wrapped value returned by the provided <code>method</code>.</td> </tr> </tbody> </table> <h5>Example</h5> <p class="code-caption">Just#chain</p> <pre class="prettyprint"><code>// Using lodash/fp/curry and get const getConfigOption = curry((path, config) => Maybe.ofNullable(get(path, config)); Maybe.ofNullable(config) .chain(getConfigOption("path.to.option"))</code></pre> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="equals"> <span class="inherited"><a href="Maybe.html#equals">inherited</a></span> equals<span class="signature">(other)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line376">line 376</a> </div> </div> </dt> <dd> <div class="description"> Determines whether or not the <code>other</code> is equal in value to the current (<code>this</code>). This is <strong>not</strong> a reference check. </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>other</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"> Other value to check.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> Boolean </td> <td class="description last"><code>true</code> if the two Maybes are equal; <code>false</code> if not equal.</td> </tr> </tbody> </table> <h5>Examples</h5> <p class="code-caption">Reflexivity</p> <pre class="prettyprint"><code>v1.equals(v1) === true; // => true</code></pre> <p class="code-caption">Symmetry</p> <pre class="prettyprint"><code>v1.equals(v2) === v2.equals(v1); // => true</code></pre> <p class="code-caption">Transitivity</p> <pre class="prettyprint"><code>(v1.equals(v2) === v2.equals(v3)) && v1.equals(v3) // => true</code></pre> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="extend"> <span class="inherited"><a href="Maybe.html#extend">inherited</a></span> <span class="type-signature ">abstract</span>extend<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Maybe.html">Maybe</a>}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line380">line 380</a> </div> </div> </dt> <dd> <div class="description"> Extends the Maybe. This is used for workflow continuation where the context has shifted. </div> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <span class="param-type"><a href="global.html#Extend">Extend</a>.&lt;<a href="Maybe.html">Maybe</a>></span> </td> <td class="description last"> method - The function to invoke with the value.</td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <a href="Maybe.html">Maybe</a> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Example</h5> <p class="code-caption">Workflow continuation</p> <pre class="prettyprint"><code>// Workflow from makeRequest.js const makeRequest = requestOptions => requestAsPromise(requestOptions) .then(Just.from) .catch(Nothing.from); // Workflow from savePerson.js const savePerson = curry((requestOptions, optionalPerson) => optionalPerson .map(Person.from) .map(person => set("body", person, requestOptions)) .map(makeRequest) ); // Workflow from processResponse.js const processResponse = optionalResponse => optionalResponse .ifJust(console.log); Maybe.ofNullable(person) .extend(savePerson({ method: "POST" })) .extend(processResponse);</code></pre> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="get"> <span class="inherited"><a href="Maybe.html#get">inherited</a></span> get<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{*}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line411">line 411</a> </div> </div> </dt> <dd> <div class="description"> Returns the value if the instance is a <a href="Just.html"><code>Just</code></a> otherwise the <code>null</code>. </div> <dl class="details"> </dl> <h5>Returns:</h5> <table class="params"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> * </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Examples</h5> <p class="code-caption">Just#get</p> <pre class="prettyprint"><code>Just.from(value).get(); // => value</code></pre> <p class="code-caption">Nothing#get</p> <pre class="prettyprint"><code>Nothing.from().get(); // => null</code></pre> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="ifJust"> <span class="inherited"><a href="Maybe.html#ifJust">inherited</a></span> <span class="type-signature ">abstract</span>ifJust<span class="signature">(method)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Maybe.html">Maybe</a>}</span> </h4> <div class="tag-source"> <a href="data_Maybe.js.html">data/Maybe.js</a>, <a href="data_Maybe.js.html#line431">