Skip to content

ikudosi/Javascript-Helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Javascript-Helpers

Object.get()

This function is tied to the window if is not yet defined. It was inspired by Laravel's array_get(). The first argument is an object / array / combination of both, and the second argument is a string representation of the property you are trying to access. For example:

var o = {
  foo: {
    bar: {
      baz: [
        {
          doge: "wow"
        }
      ]
    }
  }
}

alert(Object.get(o, 'foo.bar.baz.0.doge')); // This would output "wow"

JSFiddle: https://jsfiddle.net/juliusplaras/u6gadxva/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published