定制 aeris/fn 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aeris/fn

最新稳定版本:v1.4.0

Composer 安装命令:

composer require aeris/fn

包简介

Functional utility library

README 文档

README

Functional utility library for PHP.

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.

eg:

	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.

    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

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

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.

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

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

统计信息

  • 总下载量: 3.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-08-04