Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-value

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-value - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

27

.verbrc.md
# {%= name %} {%= badge("fury") %}
> {%= description %}
## Install
{%= include("install-npm", {save: true}) %}
## Related project
## Run tests
- [get-property](https://github.com/jonschlinkert/get-property)
- [get-object](https://github.com/jonschlinkert/get-object)
```bash
npm test
## Usage
```js
var get = require('{%= name %}');
```
## Usage
## Examples
```js
var get = require('{%= name %}');
var obj = {

@@ -30,5 +30,16 @@ a: {locals : {name: {first: 'Brian'}}},

## Install
{%= include("install-npm", {save: true}) %}
{%= include("install-bower", {save: true}) %}
## Run tests
```bash
npm test
```
## Author
{%= include("author") %}
## License

@@ -35,0 +46,0 @@ {%= copyright() %}

@@ -13,5 +13,11 @@ /*!

module.exports = function getValue(o, prop) {
if (o == null) return {};
if (o && !isObject(o)) return {};
if (prop == null) return o;
if (o == null) {
return {};
}
if (o && !isObject(o)) {
return {};
}
if (prop == null) {
return o;
}

@@ -18,0 +24,0 @@ var path = prop.split('.');

{
"name": "get-value",
"description": "Use property paths (`a.b.c`) get a nested value from an object.",
"version": "0.1.2",
"version": "0.2.0",
"homepage": "https://github.com/jonschlinkert/get-value",

@@ -6,0 +6,0 @@ "author": {

# get-value [![NPM version](https://badge.fury.io/js/get-value.svg)](http://badge.fury.io/js/get-value)
> Use property paths (`a.b.c`) get a nested value from an object.
## Install
#### Install with [npm](npmjs.org)
## Related project
```bash
npm i get-value --save
```
- [get-property](https://github.com/jonschlinkert/get-property)
- [get-object](https://github.com/jonschlinkert/get-object)
## Run tests
## Usage
```bash
npm test
```js
var get = require('get-value');
```
## Usage
## Examples
```js
var get = require('get-value');
var obj = {

@@ -35,2 +31,20 @@ a: {locals : {name: {first: 'Brian'}}},

## Install
#### Install with [npm](npmjs.org)
```bash
npm i get-value --save
```
#### Install with [bower](https://github.com/bower/bower)
```bash
bower install get-value --save
```
## Run tests
```bash
npm test
```
## Author

@@ -43,2 +57,3 @@

## License

@@ -50,2 +65,2 @@ Copyright (c) 2014 Jon Schlinkert, contributors.

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 07, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 08, 2014._

@@ -30,2 +30,28 @@ /*!

it('should get the specified property.', function () {
get({a: 'aaa', b: 'b'}, 'a').should.eql('aaa');
get({first: 'Jon', last: 'Schlinkert'}, 'first').should.eql('Jon');
get({locals: {a: 'a'}, options: {b: 'b'}}, 'locals').should.eql({a: 'a'});
});
it('should get a value only.', function () {
get({a: 'a', b: {c: 'd'}}, 'a').should.eql('a');
});
it('should return the entire object if no property is passed.', function () {
get({a: 'a', b: {c: 'd'}}).should.eql({a: 'a', b: {c: 'd'}});
});
it('should get a value only.', function () {
get({a: 'a', b: {c: 'd'}}, 'b.c').should.eql('d');
});
it('should get the value of a deeply nested property.', function () {
get({a: {b: 'c', c: {d: 'e', e: 'f', g: {h: 'i'}}}}, 'a.c.g.h').should.eql('i');
});
it('should return an empty object if the first value is null.', function () {
get(null, 'a.c.g.h').should.eql({});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc