@hypefactors/js-get
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@hypefactors/js-get", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Retrieve deeply nested properties from mixed objects and arrays using dot notation.", | ||
@@ -11,7 +11,6 @@ "main": "dist/get.js", | ||
"scripts": { | ||
"build": "npm run lint:fix && rollup -c", | ||
"build": "rollup -c", | ||
"test": "jest", | ||
"lint": "eslint src test/specs", | ||
"lint:fix": "npm run lint -- --fix", | ||
"prepublishOnly": "npm run build" | ||
"lint:fix": "npm run lint -- --fix" | ||
}, | ||
@@ -18,0 +17,0 @@ "keywords": [ |
@@ -1,1 +0,69 @@ | ||
# Get | ||
# JS-Get | ||
> A simple and lightweight dot-notiation based property resolver. | ||
[![Build Status](https://travis-ci.org/hypefactors/js-get.svg?branch=master)](https://travis-ci.org/hypefactors/js-get) | ||
[![GitHub release](https://img.shields.io/github/release/hypefactors/js-get.svg)](https://github.com/hypefactors/js-get) | ||
[![npm](https://img.shields.io/npm/dt/js-get.svg)](https://www.npmjs.com/package/js-get) | ||
## Contents | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
## Why JS-Get | ||
- Lightweight, well-documented source code bundled as CJS, EM and UMD | ||
- 100% test coverage | ||
- Supports objects and arrays | ||
## Installation | ||
To install JS-Get, just run the following: | ||
```console | ||
$ npm install @hypefactors/js-get | ||
``` | ||
> Note: This package was only tested on Node.js versions 9 and 8 or higher. | ||
## Usage | ||
Import the module via `import get from '@hypefactors/js-get'` or if you're not using a bundler use require instead (Node environment). | ||
Given that there is an object with the following structure: | ||
```javascript | ||
const profile = { | ||
age: 15, | ||
name: { | ||
first: 'John' | ||
}, | ||
activities: [ | ||
'sports', | ||
{ | ||
name: 'fishing', | ||
frequency: 'weekly' | ||
} | ||
] | ||
} | ||
``` | ||
The properties can be accessed using dot notation: | ||
```javascript | ||
get(profile, 'age') // 15 | ||
get(profile, 'name.first') // 'John' | ||
get(profile, 'activities[0]') // 'sports' | ||
get(profile, 'activities.0') // 'sports' | ||
get(profile, 'activities[1].frequency') // 'weekly' | ||
get(profile, 'foobar', 'not-found') // 'not-found' | ||
``` | ||
## Contributing | ||
Thanks for your interest in JS-Get! If you'd like to contribute, please read our [contribution guide](contribution.md). | ||
## License | ||
JS-Get is open-sourced software licensed under the ISC license. If you'd like to read the license agreement, click [here](LICENSE). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70
10022
6
0
2