All Projects → minwork → array

minwork / array

Licence: MIT License
Pack of advanced PHP array functions

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to array

rxjs-ninja
RxJS Operators for handling Observable strings, numbers, booleans and more
Stars: ✭ 68 (+51.11%)
Mutual labels:  array, array-methods, array-manipulations
js-explorer
Find the method you need without digging through the docs, directly on the command line!
Stars: ✭ 287 (+537.78%)
Mutual labels:  array, array-methods
performant-array-to-tree
Converts an array of items with ids and parent ids to a nested tree in a performant O(n) way. Runs in browsers and Node.js.
Stars: ✭ 193 (+328.89%)
Mutual labels:  array-manipulations, array-helper
linqjs
Perform queries on collections in the manner of C#s System.Linq in JavaScript
Stars: ✭ 14 (-68.89%)
Mutual labels:  array
CuVec
Unifying Python/C++/CUDA memory: Python buffered array ↔️ `std::vector` ↔️ CUDA managed memory
Stars: ✭ 73 (+62.22%)
Mutual labels:  array
repeat-element
Create an array by repeating the given string n times.
Stars: ✭ 19 (-57.78%)
Mutual labels:  array
php-helpers
A Collection of useful php helper functions.
Stars: ✭ 26 (-42.22%)
Mutual labels:  array-manipulations
arrayer
Array manipulation. Get, set & delete keys with dot notation, also prepares an array to be put in a file (php array or json).
Stars: ✭ 14 (-68.89%)
Mutual labels:  array-manipulations
lazy-arr
Arrays that look just like regular JavaScript arrays, but are computed lazily.
Stars: ✭ 67 (+48.89%)
Mutual labels:  array
arr
数组增强组件主要是对数组等数据进行处理,如无限级分类操作、商品规格的迪卡尔乘积运算等。
Stars: ✭ 62 (+37.78%)
Mutual labels:  array
arrayfire-haskell
Haskell bindings to ArrayFire
Stars: ✭ 52 (+15.56%)
Mutual labels:  array
BitLens
🔎 Have your bits and eat them too! A C++17 bit lens container for vector types.
Stars: ✭ 20 (-55.56%)
Mutual labels:  array
array undot
array_undot (the opposite of the array_dot helper function) expands a dot notation array into a full multi-dimensional array.
Stars: ✭ 15 (-66.67%)
Mutual labels:  array
pasvl
Array Validator (regular expressions for arrays, sort of)
Stars: ✭ 40 (-11.11%)
Mutual labels:  array
ts-belt
🔧 Fast, modern, and practical utility library for FP in TypeScript.
Stars: ✭ 439 (+875.56%)
Mutual labels:  array
go-streams
Stream Collections for Go. Inspired in Java 8 Streams and .NET Linq
Stars: ✭ 127 (+182.22%)
Mutual labels:  array
prototyped.js
Some common Typescript prototypes
Stars: ✭ 22 (-51.11%)
Mutual labels:  array
HashMapC
A tiny library for using easily HashMap, arraylist in the C.
Stars: ✭ 21 (-53.33%)
Mutual labels:  array
longest
Get the length of the longest item in an array.
Stars: ✭ 31 (-31.11%)
Mutual labels:  array
react-smart-key
Pass anything as key without re-renders
Stars: ✭ 17 (-62.22%)
Mutual labels:  array

Minwork Array

Build Status Coverage Status Latest Stable Version Github Stars

Pack of array convenience methods for handling:

  • Nested arrays
  • Arrays of objects
  • Associative arrays
  • Chaining array transformations

Easily create, access, validate, manipulate and transform arrays

Advanced implementation of well known operations:

Installation

composer require minwork/array

Advantages

  • Thoroughly tested
  • Well documented
  • Leverages PHP 7 syntax and speed
  • No external dependencies
  • Large variety of usages

Example of usage

// Set nested array value
$array = Arr::set([], 'key1.key2.key3', 'my_value'); 
// Which is equivalent to
[
  'key1' => [
    'key2' => [
      'key3' => 'my_value'
    ]
  ]
]

// Get nested array value
Arr::get($array, 'key1.key2') -> ['key3' => 'my_value']

// Check if array has nested element
Arr::has($array, 'key1.key2.key3') -> true 

// Map array while accessing it's key
Arr::map($array, function ($key, $value) {
   // Your code here
});

// Find array element
Arr::find($array, function ($element) {
  return Arr::get($element, 'key2.key3') === 'my_value';
}) -> [ 'key2' => [ 'key3' => 'my_value'] ]

// Chain few methods
Arr::obj(['test' => 1, 'foo' => 'bar'])
    ->set('abc', 123)
    ->set('[]', 'auto_index')
    ->remove('foo')
    ->getArray() 
->
[
  'test' => 1,
  'abc' => 123,
  'auto_index'
]

// Group objects by the result of calling method 'getSize' on each object
Arr::groupObjects([$cat, $dog, $fish, ...], 'getSize') ->
[
  'medium' => [$cat, $dog, ...],
  'small' => [$fish, ...],
  ...
]

Documentation

https://minwork.gitbook.io/array/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].