semver-select
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -6,1 +6,5 @@ # Changelog | ||
* Initial release | ||
## 1.0.1 | ||
* README update |
{ | ||
"name": "semver-select", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Select an attribute of an object based on semver versioning", | ||
@@ -5,0 +5,0 @@ "main": "./lib/", |
@@ -17,3 +17,3 @@ # semver-select.js | ||
A few useful tool for when you need to select a function or other variable based on a [semver](https://www.npmjs.com/package/semver) version. | ||
A few useful tools for when you need to select a function or other variable based on a [semver](https://www.npmjs.com/package/semver) version. | ||
@@ -26,5 +26,5 @@ For example, if you are writing an app which interacts with an API which needs a different calling signature depending on it's version, you can use this to choose a function that implements the right interface for that API version. | ||
Takes a list of choices as an object with the semver version for each choice as the object's attributes. | ||
Takes a list of choices as an object with semver match strings as the object's attributes. | ||
Loops through the object's attributes and returns the first matching result. | ||
Loops through `choice`'s attributes and returns the first matching result. | ||
Returns `undefined` if no match found. | ||
@@ -51,14 +51,2 @@ | ||
```js | ||
var obj = { | ||
monkey: { | ||
'^1.0.0': 'v1', | ||
'1.0.0 - 2.x.x': 'v2', | ||
'*': 'other' | ||
}, | ||
dinosaur: { | ||
'^1.0.0': 'ver1', | ||
'^2.0.0': 'ver2' | ||
} | ||
}; | ||
semverSelect('2.3.8', { | ||
@@ -65,0 +53,0 @@ monkey: { |
7165
82