Sha256: 036c6ac161c3c50e569a8cf7b74f24142f38c4f7ef1dce6902869d7f949330be

Contents?: true

Size: 578 Bytes

Versions: 5

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

module Recollect::Array
  module Hashie
    # ### Hash.get
    # `fetch value into hash, like Lodash.get`
    #
    # ````
    # hash = { a: 1, b: { c: 2 }, d: ['1'] }
    # Recollect::Hash.get(hash, :b, :c)
    # ````
    #
    # ````
    # hash = { a: 1, b: { c: 2 }, d: ['1'] }
    # Recollect::Hash.get(hash, 'd.0')
    # ````
    #
    # ````
    # hash = { a: 1, b: { c: 2 }, d: [{ e: 3 }] }
    # Recollect::Hash.get(hash, 'd.0.e')
    # ````
    def self.get(data, *keys)
      Utility::TryFetchOrBlank.call(data, *keys)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
recollect-array-0.1.4 lib/recollect/array/hashie.rb
recollect-array-0.1.3 lib/recollect/array/hashie.rb
recollect-array-0.1.2 lib/recollect/array/hashie.rb
recollect-array-0.1.1 lib/recollect/array/hashie.rb
recollect-array-0.1.0 lib/recollect/array/hashie.rb