Remove constant function from examples (#3086)

This commit is contained in:
Roman Gusev
2017-03-30 22:42:45 +06:00
committed by John-David Dalton
parent 64d92ddf32
commit 43a520c971
7 changed files with 14 additions and 14 deletions

View File

@@ -13,9 +13,9 @@ import arrayMap from './.internal/arrayMap.js'
* @example * @example
* *
* const func = cond([ * const func = cond([
* [matches({ 'a': 1 }), constant('matches A')], * [matches({ 'a': 1 }), () => 'matches A'],
* [conforms({ 'b': isNumber }), constant('matches B')], * [conforms({ 'b': isNumber }), () => 'matches B'],
* [() => true, constant('no match')] * [() => true, () => 'no match']
* ]) * ])
* *
* func({ 'a': 1, 'b': 2 }) * func({ 'a': 1, 'b': 2 })

View File

@@ -10,11 +10,11 @@
* @example * @example
* *
* function Foo() { * function Foo() {
* this.a = constant('a') * this.a = () => 'a'
* this.b = constant('b') * this.b = () => 'b'
* } * }
* *
* Foo.prototype.c = constant('c') * Foo.prototype.c = () => 'c'
* *
* functions(new Foo) * functions(new Foo)
* // => ['a', 'b'] * // => ['a', 'b']

View File

@@ -12,8 +12,8 @@ import invoke from './invoke.js'
* @example * @example
* *
* const objects = [ * const objects = [
* { 'a': { 'b': constant(2) } }, * { 'a': { 'b': () => 2 } },
* { 'a': { 'b': constant(1) } } * { 'a': { 'b': () => 1 } }
* ] * ]
* *
* map(objects, method('a.b')) * map(objects, method('a.b'))

View File

@@ -12,14 +12,14 @@ import invoke from './invoke.js'
* @returns {Function} Returns the new invoker function. * @returns {Function} Returns the new invoker function.
* @example * @example
* *
* const array = times(3, constant) * const array = times(3, i => () => i)
* const object = { 'a': array, 'b': array, 'c': array } * const object = { 'a': array, 'b': array, 'c': array }
* *
* map(['a[2]', 'c[0]'], methodOf(object)) * map(['a[2]', 'c[0]'], methodOf(object))
* // => [2, 0] * // => [2, 0]
* *
* map([['a', '2'], ['c', '0']], methodOf(object)) * map([['a', '2'], ['c', '0']], methodOf(object))
* // => [2, 0] * // => [2, 0]f
*/ */
function methodOf(object, args) { function methodOf(object, args) {
return (path) => invoke(object, path, args) return (path) => invoke(object, path, args)

View File

@@ -14,7 +14,7 @@ import toKey from './.internal/toKey.js'
* @returns {*} Returns the resolved value. * @returns {*} Returns the resolved value.
* @example * @example
* *
* const object = { 'a': [{ 'b': { 'c1': 3, 'c2': constant(4) } }] } * const object = { 'a': [{ 'b': { 'c1': 3, 'c2': () => 4 } }] }
* *
* result(object, 'a[0].b.c1') * result(object, 'a[0].b.c1')
* // => 3 * // => 3
@@ -25,7 +25,7 @@ import toKey from './.internal/toKey.js'
* result(object, 'a[0].b.c3', 'default') * result(object, 'a[0].b.c3', 'default')
* // => 'default' * // => 'default'
* *
* result(object, 'a[0].b.c3', constant('default')) * result(object, 'a[0].b.c3', () => 'default')
* // => 'default' * // => 'default'
*/ */
function result(object, path, defaultValue) { function result(object, path, defaultValue) {

View File

@@ -18,7 +18,7 @@ const MAX_ARRAY_LENGTH = 4294967295
* times(3, String) * times(3, String)
* // => ['0', '1', '2'] * // => ['0', '1', '2']
* *
* times(4, constant(0)) * times(4, () => 0)
* // => [0, 0, 0, 0] * // => [0, 0, 0, 0]
*/ */
function times(n, iteratee) { function times(n, iteratee) {

View File

@@ -19,7 +19,7 @@ import baseUpdate from './.internal/baseUpdate.js'
* *
* const object = {} * const object = {}
* *
* updateWith(object, '[0][1]', constant('a'), Object) * updateWith(object, '[0][1]', () => 'a', Object)
* // => { '0': { '1': 'a' } } * // => { '0': { '1': 'a' } }
*/ */
function updateWith(object, path, updater, customizer) { function updateWith(object, path, updater, customizer) {