
PHP 기능 유틸리티 라이브러리, JavaScript Port of JavaScript LODASH/FP 및 RAMDA 라이브러리 PHP.
모든 함수는 부작용이없고 자동으로 카레를 사용하며 데이터는 불변 입니다.
반복 가능한 수집 매개 변수는 일반적으로 카레를 편리하게 만들기 위해 마지막으로 제공됩니다.
게으른 / 지연 평가는 기능 파이프 라인에서 지원됩니다.
자세한 내용, 문서 및 예제는 https://idlephp.tech 를 방문하십시오.
PHP 7.4 이상
composer require miroshnikov/idles
메모
유휴 상태는 현재 활발한 개발 중입니다. 로드맵은 Lodash 및 Ramda 라이브러리의 모든 방법과 일부 기능 도구를 추가하는 것입니다.
concat(?iterable $ array, $ value ): iterable 추가 반복/값으로 $array 연결합니다
count(callable $ predicate , ?iterable $ collection ): int $collection 과 일치하는 $predicate 의 항목 수를 계산합니다.
countBy(callable $ iteratee , ?iterable $ collection ): array 배열 반환 : [ $iteratee($value) => $iteratee($value) 가 $collection 에서 발견되었습니다]
drop(int $ n , ?iterable $ collection ): iterable 첫 $n Elemens를 건너 뛰고 반복 가능한 나머지 부분을 반환합니다.
dropRight(int $ n , ?iterable $ collection ): iterable 마지막 $n 요소를 건너 뜁니다
findIndex(callable $ predicate , ?iterable $ collection ): int find 와 마찬가지로 첫 번째 요소의 인덱스를 반환합니다 -1
findLastIndex(callable $ predicate , ?iterable $ collection ): int find 와 마찬가지로 마지막 요소의 인덱스를 반환합니다. Preticate -1 를 반환합니다.
flatten(?iterable $ collection ): iterable단일 레벨 깊이로 반복 할 수 있습니다.
flattenDeep(?iterable $ collection ): iterable재귀 적으로 반복 할 수 있습니다.
flattenDepth(int $ depth , ?iterable $ collection ): iterable배열을 깊이 시간까지 재귀 적으로 평평하게하십시오.
fromPairs(?iterable $ collection ): array 목록 키 값 쌍에서 새 레코드를 만듭니다. toPairs 의 역수.
head(?iterable $ collecton )반복 가능한 첫 번째 요소를 가져옵니다
indexOf( $ value , ?iterable $ collection ): int $collection 에서 $value 의 첫 번째 발생 인덱스를 반환합니다.
intersection(?iterable $ record1 , ?iterable $ record2 ): array두 레코드에 포함 된 고유 한 값을 반환합니다
intersectionBy(callable $ iteratee , ?iterable $ record1 , ?iterable $ record2 ): array intersection 와 마찬가지로 비교 전에 각 요소에 대해 $iteratee 호출합니다.
intersectionWith(callable $ comparator , ?iterable $ record1 , ?iterable $ record2 ): array intersection 와 마찬가지로 요소를 비교하기 위해 $comparator 호출합니다.
join(string $ separator , ?iterable $ collection ): string 반복적 인 요소가 $separator 로 분리됩니다
last(?iterable $ collecton )반복 가능한 마지막 요소를 얻습니다
nth (int $ offset , ?iterable $ collection ) $offset 요소를 반환합니다. $offset 음수이면 인덱스 길이 + $offset 요소가 반환됩니다.
remove(int $ start , int $ count , ?iterable $ iterable ): array $iterable 에서 시작하여 $start 하여 $count 요소를 포함합니다.
slice(int $ start , int ? $ end , ?iterable $ collection ): iterable $start 부터 $end 까지 $iterable 슬라이스를 개조합니다.
take(int $ n , ?iterable $ collection ): iterable반복 가능한 첫 요소를 취합니다
takeRight(int $ n , ?iterable $ collection ): array끝에서 가져온 n 요소로 반복 가능한 한 조각을 반환합니다.
uniq(?iterable $ collection ): array === 사용하여 복제를 제거합니다
uniqBy(callable $ iteratee , ?iterable $ collection ): array uniq 처럼 $iteratee fist를 적용하십시오
uniqWith(callable $ predicate , ?iterable $ collection ): array uniq 와 마찬가지로 $predicate 사용하여 요소를 비교합니다
without(array $ values , ?iterable $ collection ): iterable $values 없이 $iterable 을 반환합니다
zip (iterable $ a , iterable $ b ): iterable반복 할 수있는 그룹화 된 요소를 생성하고, 첫 번째는 주어진 반복의 첫 번째 요소를 포함하고, 두 번째 요소는 두 번째 요소 등을 포함합니다.
zipWith (callable $ iteratee , iterable $ a , iterable $ b ): iterable 집단 된 값을 결합하는 방법을 지정하기 위해 $iteratee 수락한다는 점을 제외하고는 zip 처럼.
all(?callable $ predicate , ?iterable $ collection ): bool $predicate $collection 의 모든 요소에 대해 truthy 반환하는지 확인합니다. falsey 반환하면 중지하십시오
any(callable $ predicate , ?iterable $ collection ): bool $predicate $collection 의 모든 요소에 대해 Truthy를 반환하는지 확인합니다. 첫 번째 발견에서 멈 춥니 다.
each(callable $ iteratee , ?iterable $ collection ): iterable $collection 의 요소를 반복합니다. ITREATE는 false 반환하여 반복을 일찍 종료 할 수 있습니다.
filter(callable $ predicate , ?iterable $ collection ): iterable 요소를 반환합니다 $predicate 진실을 반환합니다.
find(?callable $ predicate , ?iterable $ collection ) 첫 번째 요소를 반환합니다 $predicate 진실을 반환합니다.
flatMap(callable $ iteratee , ?iterable $ collection ): iterable맵은 평평합니다
flatMapDeep(callable $ iteratee , ?iterable $ collection ): iterable flatMap 과 마찬가지로 결과를 재귀 적으로 평평하게합니다.
flatMapDepth(callable $ iteratee , int $ depth , ?iterable $ collection ): iterable flatMap 과 마찬가지로 $depth 시간까지 매핑 된 결과를 평평하게합니다.
groupBy(callable $ iteratee , ?iterable $ collection ): array $iteratee 통해 각 값을 실행하여 생성 된 키로 구성된 배열을 만듭니다.
includes( $ value , ?iterable $ collection ): bool $value 이 $collection 인지 확인합니다.
indexBy(callable $ iteratee , ?iterable $ collection ): iterable $iteratee 를 통해 $collection 의 각 요소를 실행 한 결과에서 생성 된 키로 구성된 레코드를 만듭니다.
map (callable $ iteratee , ?iterable $ collection ) $iteratee 통해 각 요소를 $collection 으로 실행하십시오.
orderBy (array $ iteratees , array $ orders , ?iterable $ collection ) sortBy 와 마찬가지로 정렬 주문을 지정할 수 있습니다
partition(callable $ predicate , ?iterable $ collection ): array $collection 두 그룹으로 분할하는데, 첫 번째는 요소 $predicate 포함되어 있으며, 두 번째는 요소 $predicate 포함합니다.
reduce (callable $ iteratee , $ accumulator , ?iterable $ collection ) $collection $iteratee 통해 컬렉션에서 각 요소를 실행 한 누적 결과 인 값으로 $ 컬렉션을 줄입니다.
resolve (array $ resolvers , array $ record ): array $resolvers 사용하여 $record 에 새로운 속성을 추가합니다.
sort(array $ comparator , ?iterable $ collection ): array $comparator 비교 ( $a <=> $b ) 함수를 사용하여 $collection 정렬
sortBy(array $ comparators , ?iterable $ collection ): array $comparators 에 따라 $collection 오름차순으로 정렬합니다.
sortWith(array $ comparators , ?iterable $ collection ): array 비교 배열 ( $a <=> $b ) 함수에 따라 $collection 정렬합니다.
values(?iterable $ collection ): iterable $collection 에서 색인 반복 값을 반환합니다.
always ( $ value )항상 주어진 값을 반환하는 함수를 반환합니다.
applyTo ( $ value , callable $ interceptor ) $interceptor($value) 반환합니다.
ary (int $ n , callable $ fn ): callable 추가 인수를 무시하고 최대 $n 인수와 함께 $fn 호출하는 함수를 만듭니다.
ascend (callable $ func , $ a , $ b ): callable <=> 와 비교할 수있는 값을 반환하는 함수에서 오름차순 비교기 기능을합니다.
attempt (callable $ fn ) $fn 호출하고 결과 또는 잡힌 예외를 반환합니다.
compose (callable . . . $ funcs ): callable pipe 처럼하지만 오른쪽에서 왼쪽으로 기능을 호출합니다.
curry (callable $ f ): callable Idles_ const는 자리 표시 자로 사용될 수 있습니다.
curryRight (callable $ f ): callable curry 와 마찬가지로 논쟁은 배정됩니다.
descend (callable $ func , $ a , $ b ): callable <=> 와 비교할 수있는 값을 반환하는 함수에서 내림차순 비교기 기능을 만듭니다.
flip (callable $ fn ): callable처음 두 인수가 반대로 된 새로운 Curried 함수를 반환합니다.
juxt (array $ funcs ): callable함수 목록을 값 목록에 적용합니다.
memoize (callable $ func ): callable $func 의 결과를 기억하는 함수를 만듭니다. $resolver 기본적으로 MAP 캐시 키, Args [0]를 반환합니다.
negate (callable $ predicate ): callable $predicate 함수의 결과를 무효화하는 함수를 만듭니다.
once (callable $ fn ): callable $fn 한 번만 호출되며, 첫 번째 값은 후속 호출에서 반환됩니다.
partial (callable $ fn , array $ partials ): callable $fn 호출하는 함수 $partials 만듭니다. Idles_ const는 자리 표시 자로 사용될 수 있습니다.
partialRight (callable $ fn , array $ partials ): callable partial 이지만 $partials 추가됩니다.
pipe (callable . . . $ funcs ): callable왼쪽에서 오른쪽 기능 구성. 첫 번째 논쟁에는 아티브가있을 수 있습니다. 나머지 주장은 단호해야합니다.
tap (callable $ interceptor , $ value ) $interceptor($value) 호출 한 다음 원래 $value 반환합니다
times (callable $ iteratee , int $ n ): array ITERATE $n 시간을 호출하여 각 호출 결과의 배열을 반환합니다.
tryCatch (callable $ tryer , callable $ catcher , $ value ) 던지는 경우 $tryer 호출하면 $catcher 호출합니다
unary (callable $ fn ): callable ary(1, $fn)
allPass (array $ predicates ): callable 인수가 모든 $predicates 통과하는지 확인하는 함수를 반환합니다.
anyPass (array $ predicates ): callable 인수가 $predicates 통과하는지 확인하는 함수를 반환합니다.
both (callable $ func1 , callable $ func2 ): callable 결과 함수가 위조 또는 $func1(...$args) 인 경우 $func2(...$args) 을 반환합니다. 그렇지 않으면 단락
cond (array $ pairs ): callable $pairs 반복하고 첫 번째 술어의 해당 함수를 진실로 반환합니다.
defaultTo ( $ default )( $ value ) $value 반환합니까 ?? $default
either (callable $ func1 , callable $ func2 ): callable 결과 함수는 진실한 경우 $func1(...$args) $func2(...$args) 반환합니다.
ifElse (callable $ predicate , callable $ onTrue , callable $ onFalse ): callable 결과 함수는 $onTrue(...$args) 가 $predicate(...$args) $onFalse(...$args) 반환합니다.
not ( $ a ): bool 반환 !$a
unless (callable $ predicate , callable $ whenFalse , mixed $ value ) $predicate($value) ? $value : $whenFalse($value)
when (callable $ predicate , callable $ whenTrue , mixed $ value ) $predicate($value) ? $whenTrue($value) : $value
add (int|float $ a , int|float $ b ): int|float$ a + $ b
dec (int $ number ): int$ 번호 -1을 반환합니다
divide (int|float $ a , int|float $ b ): int|float$ a / $ b
gt ( $ a , $ b ): bool$ a> $ b
gte ( $ a , $ b ): bool$ a> = $ b
inc (int $ number ): int$ 번호 + 1을 반환합니다
lt ( $ a , $ b ): bool$ a <$ b
lte ( $ a , $ b ): bool$ a <= $ b
modulo (int|float $ a , int|float $ b ): int$ a % $ b
multiply (int|float $ a , int|float $ b ): int|float$ a * $ b
round (int $ precision , int|float $ number ): float 지정된 $precision 의 라운드 $number
subtract (int|float $ a , int|float $ b ): int|float$ a - $ b
sum(?iterable $ collection ): int|float반복 가능한 요소를 합산합니다
sumBy(?callable $ iteratee , ?iterable $ collection ): int|float 합산 할 값을 생성하기 위해 반복 가능한 각 요소에 대해 sum 에 대해 $iteratee 호출됩니다.
assignDeep (array $ iterables ): array속성을 재귀 적으로 병합하면 숫자 키가 덮어 씁니다.
defaults(?iterable $ record1 , ?iterable $ record2 ): array속성을 오른쪽에서 왼쪽으로 병합하면 숫자 키가 덮어 씁니다.
evolve(array $ transformations , ?iterable $ record ): array $record 속성으로 변환 기능을 재귀 적으로 호출하여 새로운 레코드를 만듭니다.
extend(?iterable $ source1 , ?iterable $ source2 ): array속성을 병합하면 숫자 키가 덮어 씁니다.
has(string|int $ key , ?iterable $ record ): bool $record $key 있는지 확인합니다
hasPath(string|int|array $ path , ?iterable $ record ): bool $path 가 $record 로 존재하는지 확인합니다
invert(?iterable $ collection ): array키를 값으로 대체합니다. 중복 키가 덮어 씁니다.
keys(?iterable $ record ): iterable $record 로 인덱스 된 반복적 인 키를 반환합니다.
merge(?iterable $ source1 , ?iterable $ source2 ): array속성을 병합하면 숫자 키가 추가됩니다.
mergeDeep (array $ iterables ): array속성을 재귀 적으로 병합하면 숫자 키가 추가됩니다.
mergeLeft(?iterable $ left , ?iterable $ right ): array 통화 merge($right, $left)
mergeWith(callable $ customizer , ?iterable $ left , ?iterable $ right ): array merge 과 마찬가지로 키가 두 레코드에 존재하는 경우 $customizer 키와 관련된 값으로 호출됩니다.
modifyPath (array|string|int $ path , callable $ updater , ?iterable $ record ) 주어진 $path 에서 $updater 함수를 값에 적용하여 새 레코드를 만듭니다.
objOf (string $ key , $ value ): array 단일 키 => 값 쌍이 포함 된 array 만듭니다.
omit(array $ keys , ?iterable $ collection ): iterable pick 의 반대. $keys 없이 레코드를 반환합니다.
omitBy(callable $ predicate , ?iterable $ record ): iterable pickBy 의 반대. $predicate falsey를 반환하는 $record 의 속성을 반환합니다.
path (array|string $ path , ?iterable $ collection )주어진 경로에서 값을 검색하십시오.
paths(array $ paths , ?iterable $ collection ): array열쇠가 들어가고 가치가 있습니다. 주문이 보존됩니다.
pick(array $ keys , ?iterable $ collection ): iterable $keys 만 포함 된 레코드를 반환합니다
pickBy(callable $ predicate , ?iterable $ record ): iterable Keys $predicate 만 포함 된 레코드를 반환합니다.
pluck (string|int $ key , ?iterable $ collection )제공된 배열의 모든 레코드에서 동일한 지명 된 속성을 뽑아 새 배열을 반환합니다.
prop (string|int $ key , ?iterable $ record )지정된 속성을 반환하십시오.
propEq(string|int $ key , $ value , ?iterable $ record ): bool$ record [$ key] == $ value를 반환합니다
setPath ( $ path , $ value , ?iterable $ record ) $value 으로 $path 로 카피 $record 반환하십시오
toPairs(?iterable $ record ): iterable 레코드를 [$key, $value] 배열로 변환합니다.
where(array $ spec , ?iterable $ record ): bool $record 가 $ record의 해당 속성으로 $spec 속성을 호출하여 $record 사양을 만족하는지 확인합니다.
whereAny(array $ spec , ?iterable $ record ): bool $record 가 $ record의 해당 속성으로 $spec 속성을 호출하여 $record 사양을 만족하는지 확인합니다. Predicates 중 하나 이상이 true 반환하면 true 를 반환합니다.
whereEq(array $ spec , ?iterable $ test ): bool $test $spec 충족하는지 확인하십시오
escape (string $ s ): string문자 "&", "<", ">", ',' "" "및" ' "" "" "" ""를 해당 HTML 엔티티로 변환합니다.
escapeRegExp (string $ regexp ): string정규 표현을 탈출합니다
split (string $ separator , string $ s ): array $separator 별로 문자열을 분할합니다.
startsWith (string $ target , string $ s ): bool 문자열이 $target 으로 시작하는 경우.
toLower (string $ s ): string문자열을 소문자로 변환합니다
toUpper (string $ s ): string문자열을 대문자로 변환합니다
words (string $ pattern , string $ string ): array문자열을 단어 배열로 나눕니다.
collect(?iterable $ iterable ): array 반복 가능한 array 로 수집합니다
eq ( $ a , $ b ): bool $a == $b
equals ( $ a , $ b ): bool $a === $b
F (... $ args ): bool 항상 false 반환합니다
identity ( $ value )받는 첫 번째 인수를 반환합니다.
iterate (callable $ f , $ value ): iterable $value , $f($value) , $f($f($value)) 등의 생성기를 반환합니다.
just ( $ value ): Optional지정된 비 널 값으로 선택 사항을 반환합니다
nothing(): Optional빈 선택 사항을 반환합니다
now (): int초 수의 타임 스탬프를 반환합니다
just (mixed $ value ): Optional아마도/옵션 모나드 (컨테이너)가 아닌 값이 포함되어 있거나 포함되지 않을 수 있습니다. 방법이 있습니다 :
isPresent(): bool 비어 있지 않으면 true
isEmpty(): bool true 비어 있다면
get(): mixed 값을 반환하고, 비어 있으면 예외를 던집니다
orElse(mixed $default): mixed 옵션이 비어 있거나 $default 인 경우 포함 된 값을 반환합니다.
orElseThrow(Exception $e) - 포함 된 값을 반환합니다.
map(callable $f): Optional - 값이있는 경우 $f 적용하고 결과가 널이 아닌 경우 결과를 설명하는 선택 사항을 반환하십시오.
flatMap(callable $f): Optional - $f 반환하는 경우 map 대신 사용
filter(callable $predicate): Optional - 값이 존재하고 $predicate 와 일치하는 경우 값을 값으로 반환하십시오. 그렇지 않으면 빈 옵션이 있습니다.
size (array|Countable|object|string|callable $ value ): int계산 가능한 크기, 함수의 매개 변수 수, 문자열의 lenght 또는 객체의 속성 수를 반환합니다.
T (... $ args ): bool 항상 true 을 반환합니다