Comments (9)
What about it?
from underscore.php.
Kinna hoped this would've been possible too.
from underscore.php.
Me too!
from underscore.php.
Can you explain what it is your trying to do in a bit more detail? The originating question seems unclear to me.
I general I would say this library is fairly functionally equivalent to it's javascript brethren (underscore, lodash), well documented, and more eloquently structured than prior attempts. It would be interesting to hear, however, where you feel it doesn't meet this bar or if you feel that some additional features beyond the JS benchmarks are needed.
In the end, of course, if you you're looking for a functional superset of the intended scope I would imagine this best achieved by writing it and providing a PR. :)
from underscore.php.
In fact I posted to the wrong repo. I was actually using https://github.com/Anahkiasen/underscore-php.
And now when I read the @sadjow's issue again. I'm not sure what he meant. I was after this:
_.each(someArray, doSomeWorkOn);
See: http://joelhooks.com/blog/2014/02/06/stop-writing-for-loops-start-using-underscorejs/
The point being that I could use non-anonymous functions. I solved this with Anahkiasen's underscore.php like this.
Arrays::each($array, function ($element) { return $this->myMethod($element);});
from underscore.php.
Yeah I have mainly switched to https://github.com/Anahkiasen/underscore-php although I think both are good resources. If its solved with Anahkiasen's isn't your problem solved?
Sorry I couldn't be more help but this repo isn't a focus for me at the moment. I imagine though you could look at the Anahkiasen implementation and create a PR for this repo pretty quickly.
from underscore.php.
Problem being that there has been activity in two years on this repo. Hmmm. I think there WAS a more active version of this repo (whereas Anahkiasen's is a pretty sharp departure).
from underscore.php.
Yes, it's solved. It would be best to have something like this:
Arrays::each($array, [$this,'myMethod']);
But I think that's not possible with PHP at the moment.
from underscore.php.
BTW, I think this repo: https://github.com/JonathanAquino/Underscore.php is a more up-to-date version of Brian's repo. You're better off using this as a base and any PR's you want might add. As for native PHP implementation ... I'm actually surprised this isn't supported in 5.4+ but I'm still being held back to 5.3.x in most of my PHP so I haven't let myself see what I can not have yet.
from underscore.php.
Related Issues (20)
- documentation for iterator argument to uniq is confusing
- Composer fails to download dev-master
- __ Naming conflict with Wordpress HOT 2
- __filter for associative arrays HOT 1
- Array by Reference
- not compatible PHP 5.5.x
- groupBy will stop the chaining. HOT 1
- __::chain($array) is not same with __($array)
- _::keys & _::values return private properties.
- I write a function "object" Converts arrays into objects
- actually scratch that...
- isRegExp to use php last error?
- Context of anonymous function is lost
- pluck does not pluck values if elements are of type ArrayAccess
- Transfer ownership? HOT 14
- String helpers support
- Very good extension for php, but may be good if provided with PECL extension
- IGNORE
- Function create_function() is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from underscore.php.