2017 © Pedro Peláez
 

library fn

Functional utility library

image

aeris/fn

Functional utility library

  • Thursday, August 20, 2015
  • by eschwartz
  • Repository
  • 6 Watchers
  • 0 Stars
  • 3,245 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 37 % Grown

The README.md

Fn

Functional utility library for PHP., (*1)

API

partial

compose

identity

constant

always

never

cat

moreThanOrEqualTo

lessthan

equalTo

notEqualTo

even

odd

both

invoker

invokeAll

invoke

negate

conditional

doWhen

errorThrower

conditionalThrower

throwWhen

throwError

resolve

resolver

whenSetInvoker

keySetChecker

isKeySet

accessor

cb

zip

mapAssoc

pick

pluck

Plucks a property from a collection of associative arrays., (*2)

eg:, (*3)

    Fn\pluck([
            ['name' => 'moe', 'age' => 45],
            ['name' => 'larry', 'age' => 55],
            ['name' => 'curly', 'age' => 65]
        ], 'name');
  // --> ['moe', 'larry', 'curly']

concat

Add a value to an array, or merge a set of values., (*4)

    Fn\concat(['a', 'b'], 'c');                   // ['a', 'b', 'c']
    Fn\concat(['a', 'b'], ['c', 'd']);      // ['a', 'b', 'c', 'd']

any

Returns true if any item in the array passes a predicate, (*5)

Example:

Fn\any([1, 3, 4, 5, 9], Fn\even()) // true
Fn\any([1, 3, 5, 9], Fn\even()) // false

all

Returns true if every item in the array passes a predicate, (*6)

Example:

Fn\all([1, 3, 5, 9], Fn\odd()) // true
Fn\all([1, 3, 4, 5, 9], Fn\even()) // false

joinOr

joinAnd

factoryMap

factory

caller

countWhere

reduceAssoc

times

Invoke a callable some number of times., (*7)

Fn\times(3, function($i) {
    echo "call #$i";
})

// call 1
// call 2
// call 3

The Versions

20/08 2015

dev-master

9999999-dev

Functional utility library

  Sources   Download

The Requires

 

by Edan Schwartz

20/08 2015

v1.4.0

1.4.0.0

Functional utility library

  Sources   Download

The Requires

 

by Edan Schwartz

13/08 2015

1.2.0

1.2.0.0

Functional utility library

  Sources   Download

The Requires

 

by Edan Schwartz

07/08 2015

1.1.0

1.1.0.0

Functional utility library

  Sources   Download

by Edan Schwartz

04/08 2015

1.0.0

1.0.0.0

Functional utility library

  Sources   Download

by Edan Schwartz