1.0.7 • Published 5 years ago

get-es6 v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

LitElement component KimDo7

What is this repository for?

  • Quick summary: This is a lightweight library that has the same funcationality of lodash. It is suited for lightweight webcomponenet such as Lit-Element/Polymer 3
  • Version 1.0.7

Installation

npm i get-es6 --save


Then

import { get } from "get-es6";

Sample 1

const object = { a: [{ b: { c: 3 } }] };

get(object, "a[0].b.c"); // = 3
get(object, ["a", "0", "b", "c"]); // = 3
get(object, "a.b.c", "default"); // = "default"

Sample 2

const landmark = {
  name: "Golden Gate Bridge",
  location: {
    type: "Feature",
    properties: {
      city: "San Francisco",
      state: "California",
    },
    geometry: {
      type: "Point",
      coordinates: [-122.4804438, 37.8199328],
    },
  },
};

get(landmark, "location.geometry.type"); // = "Point"
get(landmark, "location.geometry.coordinates.0" // = -122.4804438
get(landmark, "location.geometry.coordinates[1]" // = 37.8199328

delete landmark.location;
get(landmark, "location.geometry.type") === undefined // = undefined

Who do I talk to?

  • Repo owner or admin: Kim Do
  • Linkedin: @kimdo7

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago