X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=public%2Fbower_components%2Flodash%2Flib%2Ffp%2Ftemplate%2Fdoc%2Fwiki.jst;h=188302fb9b13469485b69733d039fa963e55c926;hb=5a1e44ae9524fee72c7a05367a706d12dad9ac33;hp=90d3b653a91cc17eb0dc2c1444b881706a1374e2;hpb=1371e9b959804ff80d0f8f55a380d796dde33352;p=motion.git
diff --git a/public/bower_components/lodash/lib/fp/template/doc/wiki.jst b/public/bower_components/lodash/lib/fp/template/doc/wiki.jst
index 90d3b65..188302f 100644
--- a/public/bower_components/lodash/lib/fp/template/doc/wiki.jst
+++ b/public/bower_components/lodash/lib/fp/template/doc/wiki.jst
@@ -9,12 +9,25 @@ In a browser:
```html
+
```
In Node.js:
```js
// Load the fp build.
-var _ = require('lodash/fp');
+var fp = require('lodash/fp');
// Load a method category.
var object = require('lodash/fp/object');
@@ -23,61 +36,27 @@ var object = require('lodash/fp/object');
var extend = require('lodash/fp/extend');
```
-## Convert
-
-Although `lodash/fp` & its method modules come pre-converted there are times when
-you may want to convert another lodash package or create a customized conversion.
-Thatâs when the `convert` module comes in handy.
-
-```js
-var convert = require('lodash/fp/convert');
-
-// Convert by name.
-var assign = convert('assign', require('lodash.assign'));
+## Mapping
-// Convert by object.
-var fp = convert({
- 'assign': require('lodash.assign'),
- 'chunk': require('lodash.chunk')
-});
+Immutable auto-curried iteratee-first data-last methods sound great, but what
+does that really mean for each method? Below is a breakdown of the mapping used
+to convert each method.
-// Convert by `lodash` instance.
-var fp = convert(lodash.runInContext());
-```
+#### Capped Iteratee Arguments
-Itâs even customizable.
+Iteratee arguments are capped to avoid gotchas with variadic iteratees.
```js
-// Every option is `true` by default.
-var filter = convert('filter', _.filter, {
- // Specify capping iteratee arguments.
- 'cap': true,
- // Specify currying.
- 'curry': true,
- // Specify fixed arity.
- 'fixed': true,
- // Specify immutable operations.
- 'immutable': true,
- // Specify rearranging arguments.
- 'rearg': true
-});
-
-// Specify `cap` of `false` to create a function that doesnât cap iteratee arguments.
-var filter = convert('filter', _.filter, { 'cap': false });
-
-filter(function(value, index) {
- return index % 2 == 0;
-})(['a', 'b', 'c']);
-// => ['a', 'c']
+// The `lodash/map` iteratee receives three arguments:
+// (value, index|key, collection)
+_.map(['6', '8', '10'], parseInt);
+// â [6, NaN, 2]
+
+// The `lodash/fp/map` iteratee is capped at one argument:
+// (value)
+fp.map(parseInt)(['6', '8', '10']);
+// â [6, 8, 10]
```
-## Mapping
-
-Immutable auto-curried iteratee-first data-last methods sound great, but whatâs
-that really mean for each method? Below is a breakdown of the mapping used to
-convert each method.
-
-#### Capped Iteratee Arguments
-
Methods that cap iteratees to one argument:
<%= toFuncList(_.keys(_.pickBy(mapping.iterateeAry, _.partial(_.eq, _, 1)))) %>
@@ -88,48 +67,154 @@ The iteratee of `mapKeys` is invoked with one argument: (key)
#### Fixed Arity
+Methods have fixed arities to support auto-currying.
+```js
+// `lodash/padStart` accepts an optional `chars` param.
+_.padStart('a', 3, '-')
+// â '--a'
+
+// `lodash/fp/padStart` does not.
+fp.padStart(3)('a');
+// â ' a'
+fp.padCharsStart('-')(3)('a');
+// â '--a'
+```
+
Methods with a fixed arity of one:
-<%= toFuncList(mapping.aryMethod[1]) %>
+<%= toFuncList(_.difference(mapping.aryMethod[1], _.keys(mapping.skipFixed))) %>
Methods with a fixed arity of two:
-<%= toFuncList(mapping.aryMethod[2]) %>
+<%= toFuncList(_.difference(mapping.aryMethod[2], _.keys(mapping.skipFixed))) %>
Methods with a fixed arity of three:
-<%= toFuncList(mapping.aryMethod[3]) %>
+<%= toFuncList(_.difference(mapping.aryMethod[3], _.keys(mapping.skipFixed))) %>
Methods with a fixed arity of four:
-<%= toFuncList(mapping.aryMethod[4]) %>
+<%= toFuncList(_.difference(mapping.aryMethod[4], _.keys(mapping.skipFixed))) %>
#### Rearranged Arguments
-Methods with a fixed arity of two have an argument order of:
+Method arguments are rearranged to make composition easier.
+```js
+// `lodash/filter` is data-first iteratee-last:
+// (collection, iteratee)
+var compact = _.partial(_.filter, _, Boolean);
+compact(['a', null, 'c']);
+// â ['a', 'c']
+
+// `lodash/fp/filter` is iteratee-first data-last:
+// (iteratee, collection)
+var compact = fp.filter(Boolean);
+compact(['a', null, 'c']);
+// â ['a', 'c']
+```
+
+##### Most methods follow these rules
+
+A fixed arity of two has an argument order of:
<%= toArgOrder(mapping.aryRearg[2]) %>
-Methods with a fixed arity of three have an argument order of:
+A fixed arity of three has an argument order of:
<%= toArgOrder(mapping.aryRearg[3]) %>
-Methods with a fixed arity of four have an argument order of:
+A fixed arity of four has an argument order of:
<%= toArgOrder(mapping.aryRearg[4]) %>
-Methods with custom argument orders:
-<%= _.map(mapping.methodRearg, function(orders, methodName) {
- return ' * `_.' + methodName + '` has an order of ' + toArgOrder(orders);
-}).join('\n') %>
+##### Exceptions to the rules
+
+Methods that accept an array of arguments as their second parameter:
+<%= toFuncList(_.keys(mapping.methodSpread)) %>
Methods with unchanged argument orders:
<%= toFuncList(_.keys(mapping.skipRearg)) %>
-The methods `partial` & `partialRight` accept an array of arguments to partially
-apply as their second parameter.
+Methods with custom argument orders:
+<%= _.map(_.keys(mapping.methodRearg), function(methodName) {
+ var orders = mapping.methodRearg[methodName];
+ return ' * `_.' + methodName + '` has an order of ' + toArgOrder(orders);
+}).join('\n') %>
#### New Methods
+Not all variadic methods have corresponding new method variants. Feel free to
+[request](https://github.com/lodash/lodash/blob/master/.github/CONTRIBUTING.md#feature-requests)
+any additions.
+
Methods created to accommodate Lodashâs variadic methods:
<%= toFuncList(_.keys(mapping.remap)) %>
#### Aliases
There are <%= _.size(mapping.aliasToReal) %> method aliases:
-<%= _.map(mapping.aliasToReal, function(realName, alias) {
- return ' * Added `_.' + alias + '` as an alias of `_.' + realName + '`';
+<%= _.map(_.keys(mapping.aliasToReal).sort(), function(alias) {
+ var realName = mapping.aliasToReal[alias];
+ return ' * `_.' + alias + '` is an alias of `_.' + realName + '`';
}).join('\n') %>
+
+## Placeholders
+
+The placeholder argument, which defaults to `_`, may be used to fill in method
+arguments in a different order. Placeholders are filled by the first available
+arguments of the curried returned function.
+```js
+// The equivalent of `2 > 5`.
+_.gt(2)(5);
+// â false
+
+// The equivalent of `_.gt(5, 2)` or `5 > 2`.
+_.gt(_, 2)(5);
+// â true
+```
+
+## Chaining
+
+The `lodash/fp` module **does not** convert chain sequence methods. See
+[Izaak Schroederâs article](https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba)
+on using functional composition as an alternative to method chaining.
+
+## Convert
+
+Although `lodash/fp` & its method modules come pre-converted, there are times
+when you may want to customize the conversion. Thatâs when the `convert` method
+comes in handy.
+```js
+// Every option is `true` by default.
+var _fp = fp.convert({
+ // Specify capping iteratee arguments.
+ 'cap': true,
+ // Specify currying.
+ 'curry': true,
+ // Specify fixed arity.
+ 'fixed': true,
+ // Specify immutable operations.
+ 'immutable': true,
+ // Specify rearranging arguments.
+ 'rearg': true
+});
+
+// The `convert` method is available on each method too.
+var mapValuesWithKey = fp.mapValues.convert({ 'cap': false });
+
+// Hereâs an example of disabling iteratee argument caps to access the `key` param.
+mapValuesWithKey(function(value, key) {
+ return key == 'a' ? -1 : value;
+})({ 'a': 1, 'b': 1 });
+// => { 'a': -1, 'b': 1 }
+```
+
+Manual conversions are also possible with the `convert` module.
+```js
+var convert = require('lodash/fp/convert');
+
+// Convert by name.
+var assign = convert('assign', require('lodash.assign'));
+
+// Convert by object.
+var fp = convert({
+ 'assign': require('lodash.assign'),
+ 'chunk': require('lodash.chunk')
+});
+
+// Convert by `lodash` instance.
+var fp = convert(lodash.runInContext());
+```