Comparing version 1.0.2 to 1.1.0
@@ -11,10 +11,11 @@ /** | ||
module.exports = function(holder, propName){ | ||
if (propName === undefined) return holder; | ||
if (propName == null || !holder) return holder; | ||
var propParts = (propName + '').split('.'); | ||
var result = holder, lastPropName; | ||
while ((lastPropName = propParts.shift()) !== undefined) { | ||
if (result[lastPropName] === undefined) return undefined; | ||
while ((lastPropName = propParts.shift()) != null) { | ||
if (!result[lastPropName]) return !propParts.length ? result[lastPropName] : undefined; | ||
result = result[lastPropName]; | ||
} | ||
return result; | ||
}; | ||
}; |
{ | ||
"name": "dotprop", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Get property value by dot notation", | ||
@@ -12,8 +12,5 @@ "main": "index.js", | ||
], | ||
"analogs": [ | ||
"dot-prop" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:dfcreative/dotprop.git" | ||
"url": "git@github.com:dy/dotprop.git" | ||
}, | ||
@@ -33,14 +30,17 @@ "keywords": [ | ||
"get", | ||
"access" | ||
"access", | ||
"getprop", | ||
"ramda.path", | ||
"dot path" | ||
], | ||
"author": { | ||
"name": "Deema Yvanow", | ||
"email": "dfcreative@gmail.com", | ||
"url": "http://github.com/dfcreative" | ||
"name": "Dima Yv", | ||
"email": "df.creative@gmail.com", | ||
"url": "http://github.com/dy" | ||
}, | ||
"license": "unlicensed", | ||
"bugs": { | ||
"url": "https://github.com/dfcreative/dotprop/issues" | ||
"url": "https://github.com/dy/dotprop/issues" | ||
}, | ||
"homepage": "https://github.com/dfcreative/dotprop" | ||
"homepage": "https://github.com/dy/dotprop" | ||
} |
@@ -1,2 +0,2 @@ | ||
# dotprop [![Build Status](https://travis-ci.org/dfcreative/dotprop.svg?branch=master)](https://travis-ci.org/dfcreative/dotprop) [![Code Climate](https://codeclimate.com/github/dfcreative/dotprop/badges/gpa.svg)](https://codeclimate.com/github/dfcreative/dotprop) <a href="http://unlicense.org/UNLICENSE"><img src="http://upload.wikimedia.org/wikipedia/commons/6/62/PD-icon.svg" width="20"/></a> | ||
# dotprop [![Build Status](https://travis-ci.org/dy/dotprop.svg?branch=master)](https://travis-ci.org/dy/dotprop) | ||
@@ -14,2 +14,2 @@ Get property by dot notation. | ||
[![NPM](https://nodei.co/npm/dotprop.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/dotprop/) | ||
[![NPM](https://nodei.co/npm/dotprop.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/dotprop/) |
3003
4
19
15