SINTEF-9012/Rodash

Getting array element does not work

Closed this issue · 5 comments

It doesn't seem to be possible to get something when the top-level element is an array.

Rodash.get([{'a' => 1},{'a' => 2}], '[0].a')

... results in:

Traceback (most recent call last):
        5: from /usr/local/bin/irb:11:in `<main>'
        4: from (irb):2
        3: from /usr/local/lib/ruby/gems/2.5.0/gems/rodash-3.0.0/lib/rodash.rb:54:in `get'
        2: from /usr/local/lib/ruby/gems/2.5.0/gems/rodash-3.0.0/lib/rodash.rb:123:in `baseGet'
        1: from /usr/local/lib/ruby/gems/2.5.0/gems/rodash-3.0.0/lib/rodash.rb:167:in `isKey'
NoMethodError (undefined method `has_key?' for [{"a"=>1}, {"a"=>2}]:Array)

reference PR #4

@this-chris awesome, thanks man! Maybe @jakhog, @sdalgard or @brice-morin could help out with merging this? I see they have been active pretty recently in this company repo.

Thanks in advance!

@brice-morin thank you for merging.

For everyone else still using this Gem: In order to have this issue solved, you'll need to gem 'rodash', :git => 'https://github.com/SINTEF-9012/Rodash.git' in your Gemfile, as the fix provided by @this-chris was not released as a new version yet.

@SINTEF-9012 feel free to close this issue as soon as someone from your side has released a new version of this Gem that contains the bugfix. Thanks!

Hi @mrusme
I created a repo that contains so many Lodash functions!

https://github.com/Attrash-Islam/rudash

I hope you can get what you're looking for.

The gem has finally been updated. Sorry for the wait.