@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | function pipe() { |
| 96 | 96 | $fns = func_get_args(); |
| 97 | - if(count($fns) < 1) |
|
| 97 | + if (count($fns) < 1) |
|
| 98 | 98 | return identity(); |
| 99 | - return curry(function () use ($fns) { |
|
| 99 | + return curry(function() use ($fns) { |
|
| 100 | 100 | $result = _apply(array_shift($fns), func_get_args()); |
| 101 | 101 | foreach ($fns as $fn) { |
| 102 | 102 | $result = $fn($result); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | static $comparator = false; |
| 266 | 266 | $comparator = $comparator ?: curry(function($fn) { |
| 267 | 267 | return function($a, $b) use($fn) { |
| 268 | - if ($fn($a, $b)) return -1; |
|
| 268 | + if ($fn($a, $b)) return - 1; |
|
| 269 | 269 | if ($fn($b, $a)) return 1; |
| 270 | 270 | return 0; |
| 271 | 271 | }; |
@@ -3,124 +3,124 @@ |
||
| 3 | 3 | use Tarsana\Functional as F; |
| 4 | 4 | |
| 5 | 5 | return F\map(F\apply(F\_f('_stream_operation')), [ |
| 6 | - ['then', 'Function -> Any -> Any', F\_f('_stream_then')], |
|
| 7 | - ['and', 'Boolean -> Boolean -> Boolean', F\and_()], |
|
| 8 | - ['or', 'Boolean -> Boolean -> Boolean', F\or_()], |
|
| 9 | - ['not', 'Boolean -> Boolean', F\not()], |
|
| 10 | - ['eq', 'Any -> Any -> Boolean', F\eq()], |
|
| 11 | - ['notEq', 'Any -> Any -> Boolean', F\notEq()], |
|
| 12 | - ['eqq', 'Any -> Any -> Boolean', F\eqq()], |
|
| 13 | - ['notEqq', 'Any -> Any -> Boolean', F\notEqq()], |
|
| 14 | - ['equals', 'Any -> Any -> Boolean', F\equals()], |
|
| 15 | - ['equalBy', 'Function -> Any -> Any -> Boolean', F\equalBy()], |
|
| 16 | - ['lt', 'Any -> Any -> Boolean', F\lt()], |
|
| 17 | - ['lte', 'Any -> Any -> Boolean', F\lte()], |
|
| 18 | - ['gt', 'Any -> Any -> Boolean', F\gt()], |
|
| 19 | - ['gte', 'Any -> Any -> Boolean', F\gte()], |
|
| 20 | - ['is', 'String -> Any -> Boolean', F\is()], |
|
| 21 | - ['toString', 'Any -> String', F\toString()], |
|
| 22 | - ['attributes', 'Object|Array -> Object|Array', F\attributes()], |
|
| 23 | - ['keys', 'List -> List', F\keys()], |
|
| 24 | - ['keys', 'Object|Array -> List', F\keys()], |
|
| 25 | - ['values', 'List -> List', F\values()], |
|
| 26 | - ['values', 'Object|Array -> List', F\values()], |
|
| 27 | - ['has', 'Any -> Object|Array -> Boolean', F\has()], |
|
| 28 | - ['get', 'Any -> Object|Array -> Any', F\get()], |
|
| 29 | - ['getPath', 'List -> Object|Array -> Any', F\getPath()], |
|
| 30 | - ['set', 'Any -> Any -> Object|Array -> Object|Array', F\set()], |
|
| 31 | - ['update', 'Any -> Function -> Object|Array -> Object|Array', F\update()], |
|
| 32 | - ['satisfies', 'Function -> Any -> Object|Array -> Boolean', F\satisfies()], |
|
| 33 | - ['satisfiesAll', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAll()], |
|
| 34 | - ['satisfiesAny', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAny()], |
|
| 35 | - ['toPairs', 'Object|Array -> List', F\toPairs()], |
|
| 36 | - ['split', 'String -> String -> List', F\split()], |
|
| 37 | - ['join', 'String -> List -> String', F\join()], |
|
| 38 | - ['replace', 'String|List -> String|List -> String -> String', F\replace()], |
|
| 39 | - ['regReplace', 'String -> String -> String -> String', F\regReplace()], |
|
| 40 | - ['upperCase', 'String -> String', F\upperCase()], |
|
| 41 | - ['lowerCase', 'String -> String', F\lowerCase()], |
|
| 42 | - ['camelCase', 'String -> String', F\camelCase()], |
|
| 43 | - ['snakeCase', 'String -> String -> String', F\snakeCase()], |
|
| 44 | - ['startsWith', 'String -> String -> Boolean', F\startsWith()], |
|
| 45 | - ['endsWith', 'String -> String -> Boolean', F\endsWith()], |
|
| 46 | - ['test', 'String -> String -> Boolean', F\test()], |
|
| 47 | - ['match', 'String -> String -> List', F\match()], |
|
| 48 | - ['occurences', 'String -> String -> Number', F\occurences()], |
|
| 49 | - ['chunks', 'String -> String -> String -> List', F\chunks()], |
|
| 50 | - ['map', 'Function -> List -> List', F\map()], |
|
| 51 | - ['chain', 'Function -> List -> List', F\chain()], |
|
| 52 | - ['filter', 'Function -> List -> List', F\filter()], |
|
| 53 | - ['reduce', 'Function -> Any -> List -> Any', F\reduce()], |
|
| 54 | - ['each', 'Function -> List -> List', F\each()], |
|
| 55 | - ['head', 'List -> Any', F\head()], |
|
| 56 | - ['head', 'String -> String', F\head()], |
|
| 57 | - ['last', 'List -> Any', F\last()], |
|
| 58 | - ['last', 'String -> String', F\last()], |
|
| 59 | - ['init', 'List -> Any', F\init()], |
|
| 60 | - ['init', 'String -> String', F\init()], |
|
| 61 | - ['tail', 'List -> Any', F\tail()], |
|
| 62 | - ['tail', 'String -> String', F\tail()], |
|
| 63 | - ['reverse', 'List -> List', F\reverse()], |
|
| 64 | - ['reverse', 'String -> String', F\reverse()], |
|
| 65 | - ['length', 'List -> Number', F\length()], |
|
| 66 | - ['length', 'String -> Number', F\length()], |
|
| 67 | - ['allSatisfies', 'Function -> List -> Boolean', F\allSatisfies()], |
|
| 68 | - ['anySatisfies', 'Function -> List -> Boolean', F\anySatisfies()], |
|
| 69 | - ['concat', 'List -> List -> List', F\concat()], |
|
| 70 | - ['concat', 'String -> String -> String', F\concat()], |
|
| 71 | - ['concatAll', 'List -> List', F\concatAll()], |
|
| 72 | - ['insert', 'Number -> Any -> List -> List', F\insert()], |
|
| 73 | - ['insert', 'Number -> String -> String -> String', F\insert()], |
|
| 74 | - ['insertAll', 'Number -> List -> List -> List', F\insertAll()], |
|
| 75 | - ['insertAll', 'Number -> String -> String -> String', F\insertAll()], |
|
| 76 | - ['append', 'Any -> List -> List', F\append()], |
|
| 77 | - ['append', 'String -> String -> String', F\append()], |
|
| 78 | - ['prepend', 'Any -> List -> List', F\prepend()], |
|
| 79 | - ['prepend', 'String -> String -> String', F\prepend()], |
|
| 80 | - ['take', 'Number -> List -> List', F\take()], |
|
| 81 | - ['take', 'Number -> String -> String', F\take()], |
|
| 82 | - ['takeWhile', 'Function -> List -> List', F\takeWhile()], |
|
| 83 | - ['takeLastWhile', 'Function -> List -> List', F\takeLastWhile()], |
|
| 84 | - ['takeUntil', 'Function -> List -> List', F\takeUntil()], |
|
| 85 | - ['takeLastUntil', 'Function -> List -> List', F\takeLastUntil()], |
|
| 86 | - ['remove', 'Number -> List -> List', F\remove()], |
|
| 87 | - ['remove', 'Number -> String -> String', F\remove()], |
|
| 88 | - ['removeWhile', 'Function -> List -> List', F\removeWhile()], |
|
| 89 | - ['removeLastWhile', 'Function -> List -> List', F\removeLastWhile()], |
|
| 90 | - ['removeUntil', 'Function -> List -> List', F\removeUntil()], |
|
| 91 | - ['removeLastUntil', 'Function -> List -> List', F\removeLastUntil()], |
|
| 92 | - ['fromPairs', 'List -> Object|Array', F\fromPairs()], |
|
| 93 | - ['slices', 'Number -> List -> List', F\slices()], |
|
| 94 | - ['slices', 'Number -> String -> List', F\slices()], |
|
| 95 | - ['contains', 'Any -> List -> Boolean', F\contains()], |
|
| 96 | - ['contains', 'String -> String -> Boolean', F\contains()], |
|
| 97 | - ['findIndex', 'Function -> List -> Number|Null', F\findIndex()], |
|
| 98 | - ['findIndex', 'Function -> Object|Array -> Any', F\findIndex()], |
|
| 99 | - ['findLastIndex', 'Function -> List -> Number|Null', F\findLastIndex()], |
|
| 100 | - ['findLastIndex', 'Function -> Object|Array -> Any', F\findLastIndex()], |
|
| 101 | - ['find', 'Function -> List -> Any', F\find()], |
|
| 102 | - ['findLast', 'Function -> List -> Any', F\findLast()], |
|
| 103 | - ['indexOf', 'Any -> List -> Number', F\indexOf()], |
|
| 104 | - ['indexOf', 'Any -> Object|Array -> Any', F\indexOf()], |
|
| 105 | - ['indexOf', 'String -> String -> Number', F\indexOf()], |
|
| 106 | - ['lastIndexOf', 'Any -> List -> Number', F\lastIndexOf()], |
|
| 107 | - ['lastIndexOf', 'String -> String -> Number', F\lastIndexOf()], |
|
| 108 | - ['uniqueBy', 'Function -> List -> List', F\uniqueBy()], |
|
| 109 | - ['unique', 'List -> List', F\unique()], |
|
| 110 | - ['groupBy', 'Function -> List -> Object|Array', F\groupBy()], |
|
| 111 | - ['pairsFrom', 'List -> List -> List', F\pairsFrom()], |
|
| 112 | - ['sort', 'Function -> List -> List', F\sort()], |
|
| 113 | - ['plus', 'Number -> Number -> Number', F\plus()], |
|
| 114 | - ['minus', 'Number -> Number -> Number', F\minus()], |
|
| 115 | - ['negate', 'Number -> Number', F\negate()], |
|
| 116 | - ['multiply', 'Number -> Number -> Number', F\multiply()], |
|
| 117 | - ['divide', 'Number -> Number -> Number', F\divide()], |
|
| 118 | - ['modulo', 'Number -> Number -> Number', F\modulo()], |
|
| 119 | - ['sum', 'List -> Number', F\sum()], |
|
| 120 | - ['product', 'List -> Number', F\product()], |
|
| 121 | - ['min', 'Number -> Number -> Number', F\min()], |
|
| 122 | - ['minBy', 'Function -> Any -> Any -> Any', F\minBy()], |
|
| 123 | - ['max', 'Number -> Number -> Number', F\max()], |
|
| 124 | - ['maxBy', 'Function -> Any -> Any -> Any', F\maxBy()], |
|
| 6 | + ['then', 'Function -> Any -> Any', F\_f('_stream_then')], |
|
| 7 | + ['and', 'Boolean -> Boolean -> Boolean', F\and_()], |
|
| 8 | + ['or', 'Boolean -> Boolean -> Boolean', F\or_()], |
|
| 9 | + ['not', 'Boolean -> Boolean', F\not()], |
|
| 10 | + ['eq', 'Any -> Any -> Boolean', F\eq()], |
|
| 11 | + ['notEq', 'Any -> Any -> Boolean', F\notEq()], |
|
| 12 | + ['eqq', 'Any -> Any -> Boolean', F\eqq()], |
|
| 13 | + ['notEqq', 'Any -> Any -> Boolean', F\notEqq()], |
|
| 14 | + ['equals', 'Any -> Any -> Boolean', F\equals()], |
|
| 15 | + ['equalBy', 'Function -> Any -> Any -> Boolean', F\equalBy()], |
|
| 16 | + ['lt', 'Any -> Any -> Boolean', F\lt()], |
|
| 17 | + ['lte', 'Any -> Any -> Boolean', F\lte()], |
|
| 18 | + ['gt', 'Any -> Any -> Boolean', F\gt()], |
|
| 19 | + ['gte', 'Any -> Any -> Boolean', F\gte()], |
|
| 20 | + ['is', 'String -> Any -> Boolean', F\is()], |
|
| 21 | + ['toString', 'Any -> String', F\toString()], |
|
| 22 | + ['attributes', 'Object|Array -> Object|Array', F\attributes()], |
|
| 23 | + ['keys', 'List -> List', F\keys()], |
|
| 24 | + ['keys', 'Object|Array -> List', F\keys()], |
|
| 25 | + ['values', 'List -> List', F\values()], |
|
| 26 | + ['values', 'Object|Array -> List', F\values()], |
|
| 27 | + ['has', 'Any -> Object|Array -> Boolean', F\has()], |
|
| 28 | + ['get', 'Any -> Object|Array -> Any', F\get()], |
|
| 29 | + ['getPath', 'List -> Object|Array -> Any', F\getPath()], |
|
| 30 | + ['set', 'Any -> Any -> Object|Array -> Object|Array', F\set()], |
|
| 31 | + ['update', 'Any -> Function -> Object|Array -> Object|Array', F\update()], |
|
| 32 | + ['satisfies', 'Function -> Any -> Object|Array -> Boolean', F\satisfies()], |
|
| 33 | + ['satisfiesAll', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAll()], |
|
| 34 | + ['satisfiesAny', 'Object|Array -> Object|Array -> Boolean', F\satisfiesAny()], |
|
| 35 | + ['toPairs', 'Object|Array -> List', F\toPairs()], |
|
| 36 | + ['split', 'String -> String -> List', F\split()], |
|
| 37 | + ['join', 'String -> List -> String', F\join()], |
|
| 38 | + ['replace', 'String|List -> String|List -> String -> String', F\replace()], |
|
| 39 | + ['regReplace', 'String -> String -> String -> String', F\regReplace()], |
|
| 40 | + ['upperCase', 'String -> String', F\upperCase()], |
|
| 41 | + ['lowerCase', 'String -> String', F\lowerCase()], |
|
| 42 | + ['camelCase', 'String -> String', F\camelCase()], |
|
| 43 | + ['snakeCase', 'String -> String -> String', F\snakeCase()], |
|
| 44 | + ['startsWith', 'String -> String -> Boolean', F\startsWith()], |
|
| 45 | + ['endsWith', 'String -> String -> Boolean', F\endsWith()], |
|
| 46 | + ['test', 'String -> String -> Boolean', F\test()], |
|
| 47 | + ['match', 'String -> String -> List', F\match()], |
|
| 48 | + ['occurences', 'String -> String -> Number', F\occurences()], |
|
| 49 | + ['chunks', 'String -> String -> String -> List', F\chunks()], |
|
| 50 | + ['map', 'Function -> List -> List', F\map()], |
|
| 51 | + ['chain', 'Function -> List -> List', F\chain()], |
|
| 52 | + ['filter', 'Function -> List -> List', F\filter()], |
|
| 53 | + ['reduce', 'Function -> Any -> List -> Any', F\reduce()], |
|
| 54 | + ['each', 'Function -> List -> List', F\each()], |
|
| 55 | + ['head', 'List -> Any', F\head()], |
|
| 56 | + ['head', 'String -> String', F\head()], |
|
| 57 | + ['last', 'List -> Any', F\last()], |
|
| 58 | + ['last', 'String -> String', F\last()], |
|
| 59 | + ['init', 'List -> Any', F\init()], |
|
| 60 | + ['init', 'String -> String', F\init()], |
|
| 61 | + ['tail', 'List -> Any', F\tail()], |
|
| 62 | + ['tail', 'String -> String', F\tail()], |
|
| 63 | + ['reverse', 'List -> List', F\reverse()], |
|
| 64 | + ['reverse', 'String -> String', F\reverse()], |
|
| 65 | + ['length', 'List -> Number', F\length()], |
|
| 66 | + ['length', 'String -> Number', F\length()], |
|
| 67 | + ['allSatisfies', 'Function -> List -> Boolean', F\allSatisfies()], |
|
| 68 | + ['anySatisfies', 'Function -> List -> Boolean', F\anySatisfies()], |
|
| 69 | + ['concat', 'List -> List -> List', F\concat()], |
|
| 70 | + ['concat', 'String -> String -> String', F\concat()], |
|
| 71 | + ['concatAll', 'List -> List', F\concatAll()], |
|
| 72 | + ['insert', 'Number -> Any -> List -> List', F\insert()], |
|
| 73 | + ['insert', 'Number -> String -> String -> String', F\insert()], |
|
| 74 | + ['insertAll', 'Number -> List -> List -> List', F\insertAll()], |
|
| 75 | + ['insertAll', 'Number -> String -> String -> String', F\insertAll()], |
|
| 76 | + ['append', 'Any -> List -> List', F\append()], |
|
| 77 | + ['append', 'String -> String -> String', F\append()], |
|
| 78 | + ['prepend', 'Any -> List -> List', F\prepend()], |
|
| 79 | + ['prepend', 'String -> String -> String', F\prepend()], |
|
| 80 | + ['take', 'Number -> List -> List', F\take()], |
|
| 81 | + ['take', 'Number -> String -> String', F\take()], |
|
| 82 | + ['takeWhile', 'Function -> List -> List', F\takeWhile()], |
|
| 83 | + ['takeLastWhile', 'Function -> List -> List', F\takeLastWhile()], |
|
| 84 | + ['takeUntil', 'Function -> List -> List', F\takeUntil()], |
|
| 85 | + ['takeLastUntil', 'Function -> List -> List', F\takeLastUntil()], |
|
| 86 | + ['remove', 'Number -> List -> List', F\remove()], |
|
| 87 | + ['remove', 'Number -> String -> String', F\remove()], |
|
| 88 | + ['removeWhile', 'Function -> List -> List', F\removeWhile()], |
|
| 89 | + ['removeLastWhile', 'Function -> List -> List', F\removeLastWhile()], |
|
| 90 | + ['removeUntil', 'Function -> List -> List', F\removeUntil()], |
|
| 91 | + ['removeLastUntil', 'Function -> List -> List', F\removeLastUntil()], |
|
| 92 | + ['fromPairs', 'List -> Object|Array', F\fromPairs()], |
|
| 93 | + ['slices', 'Number -> List -> List', F\slices()], |
|
| 94 | + ['slices', 'Number -> String -> List', F\slices()], |
|
| 95 | + ['contains', 'Any -> List -> Boolean', F\contains()], |
|
| 96 | + ['contains', 'String -> String -> Boolean', F\contains()], |
|
| 97 | + ['findIndex', 'Function -> List -> Number|Null', F\findIndex()], |
|
| 98 | + ['findIndex', 'Function -> Object|Array -> Any', F\findIndex()], |
|
| 99 | + ['findLastIndex', 'Function -> List -> Number|Null', F\findLastIndex()], |
|
| 100 | + ['findLastIndex', 'Function -> Object|Array -> Any', F\findLastIndex()], |
|
| 101 | + ['find', 'Function -> List -> Any', F\find()], |
|
| 102 | + ['findLast', 'Function -> List -> Any', F\findLast()], |
|
| 103 | + ['indexOf', 'Any -> List -> Number', F\indexOf()], |
|
| 104 | + ['indexOf', 'Any -> Object|Array -> Any', F\indexOf()], |
|
| 105 | + ['indexOf', 'String -> String -> Number', F\indexOf()], |
|
| 106 | + ['lastIndexOf', 'Any -> List -> Number', F\lastIndexOf()], |
|
| 107 | + ['lastIndexOf', 'String -> String -> Number', F\lastIndexOf()], |
|
| 108 | + ['uniqueBy', 'Function -> List -> List', F\uniqueBy()], |
|
| 109 | + ['unique', 'List -> List', F\unique()], |
|
| 110 | + ['groupBy', 'Function -> List -> Object|Array', F\groupBy()], |
|
| 111 | + ['pairsFrom', 'List -> List -> List', F\pairsFrom()], |
|
| 112 | + ['sort', 'Function -> List -> List', F\sort()], |
|
| 113 | + ['plus', 'Number -> Number -> Number', F\plus()], |
|
| 114 | + ['minus', 'Number -> Number -> Number', F\minus()], |
|
| 115 | + ['negate', 'Number -> Number', F\negate()], |
|
| 116 | + ['multiply', 'Number -> Number -> Number', F\multiply()], |
|
| 117 | + ['divide', 'Number -> Number -> Number', F\divide()], |
|
| 118 | + ['modulo', 'Number -> Number -> Number', F\modulo()], |
|
| 119 | + ['sum', 'List -> Number', F\sum()], |
|
| 120 | + ['product', 'List -> Number', F\product()], |
|
| 121 | + ['min', 'Number -> Number -> Number', F\min()], |
|
| 122 | + ['minBy', 'Function -> Any -> Any -> Any', F\minBy()], |
|
| 123 | + ['max', 'Number -> Number -> Number', F\max()], |
|
| 124 | + ['maxBy', 'Function -> Any -> Any -> Any', F\maxBy()], |
|
| 125 | 125 | |
| 126 | 126 | ]); |