nanoscope
Version:
A Lens Library for Javascript
1,443 lines (474 loc) • 17.7 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>nanoscope Global</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.spacelab.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top ">
<div class="navbar-inner">
<a class="brand" href="index.html">nanoscope</a>
<ul class="nav">
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="Compose.html">Compose</a>
</li>
<li>
<a href="Getter.html">Getter</a>
</li>
<li>
<a href="IndexedLens.html">IndexedLens</a>
</li>
<li>
<a href="IndexedLens.Unsafe.html">IndexedLens.Unsafe</a>
</li>
<li>
<a href="Lens.html">Lens</a>
</li>
<li>
<a href="MultiLens.html">MultiLens</a>
</li>
<li>
<a href="Optional.html">Optional</a>
</li>
<li>
<a href="PathLens.html">PathLens</a>
</li>
<li>
<a href="PathLens.Unsafe.html">PathLens.Unsafe</a>
</li>
<li>
<a href="Setter.html">Setter</a>
</li>
<li>
<a href="SliceLens.html">SliceLens</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="global.html#get">get</a>
</li>
<li>
<a href="global.html#IdLens">IdLens</a>
</li>
<li>
<a href="global.html#map">map</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2>
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Never allow <code>get</code> in a setter</p>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(path, unsafe)</span><span class="type-signature"> → {function}</span></h4>
</dt>
<dd>
<div class="description">
<p>Safely get a value from a path (as an array or a dot-delimited string).</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Array</span>
</td>
<td class="description last"><p>Array or dot-delimited string describing a path to follow in an object</p></td>
</tr>
<tr>
<td class="name"><code>unsafe</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true, fails if element at path doesn't exist</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(i, j)</span><span class="type-signature"> → {function}</span></h4>
</dt>
<dd>
<div class="description">
<p>Get the slice of an array from <code>i</code> to <code>j</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>i</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The start of the slice</p></td>
</tr>
<tr>
<td class="name"><code>j</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The end of the slice</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(index, unsafe)</span><span class="type-signature"> → {function}</span></h4>
</dt>
<dd>
<div class="description">
<p>Get the element at a specific index of an array</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The index to get</p></td>
</tr>
<tr>
<td class="name"><code>unsafe</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true, throw an error if index is invalid</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The get function required to construct a Lens</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="IdLens"><span class="type-signature"></span>IdLens<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The simplest possible <code>Lens</code>: operates on a single object; <code>get</code> returns the object and <code>map</code> applies a function to it
and returns the result.</p>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="map"><span class="type-signature"></span>map<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Never allow <code>map</code> in a getter</p>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="map"><span class="type-signature"></span>map<span class="signature">(i, j)</span><span class="type-signature"> → {function}</span></h4>
</dt>
<dd>
<div class="description">
<p>Map a function over a slice of an array and return the modified array.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>i</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The start of the slice (may be negative)</p></td>
</tr>
<tr>
<td class="name"><code>j</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The end of the slice (may be negative)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="map"><span class="type-signature"></span>map<span class="signature">(path, unsafe)</span><span class="type-signature"> → {function}</span></h4>
</dt>
<dd>
<div class="description">
<p>Map a function over a value gotten from some path in the object and return a new object.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Array</span>
</td>
<td class="description last"><p>Array or dot-delimited string describing a path to follow in an object</p></td>
</tr>
<tr>
<td class="name"><code>unsafe</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true, fails if element at path doesn't exist</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="map"><span class="type-signature"></span>map<span class="signature">(index, unsafe)</span><span class="type-signature"> → {function}</span></h4>
</dt>
<dd>
<div class="description">
<p>Map a function over the value at some index in an array.
Index must be in the interval <code>[0, array.length]</code> (inclusive); i.e. you may only modify existing elements or
add an element to the end.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>The index to map over</p></td>
</tr>
<tr>
<td class="name"><code>unsafe</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true, throw an error if index isn't valid.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The map function required to construct a Lens</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">function</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha11</a>
on 2014-12-17T09:37:57-05:00 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<!--<script src="scripts/sunlight.js"></script>-->
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : "100px"
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
lang = "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : false,
showMenu : true,
enableDoclinks : true
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
</body>
</html>