@airemad/stations
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [1.1.0](https://github.com/airemad/stations/compare/v1.0.0...v1.1.0) (2022-04-29) | ||
### Features | ||
* added feature getStationById ([fccc586](https://github.com/airemad/stations/commits/fccc5864d56d69c7b47c86a93c7bc6863803959f)) | ||
## [1.0.0](https://github.com/airemad/stations/compare/v0.1.4...v1.0.0) (2022-04-29) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "@airemad/stations", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "List of the measurement stations available in Madrid", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -34,2 +34,4 @@ <p align="center"><h1 align="center"> | ||
## Usage | ||
### Get All Stations | ||
```js | ||
@@ -61,2 +63,20 @@ const { getAll } = require('@airemad/stations') | ||
### Get specific station | ||
```js | ||
const { getStationById } = require('@airemad/stations') | ||
const station = getStationById('0086') // 86, '86', '000086' ... | ||
console.log(station) | ||
/* | ||
{ | ||
"id": "86", | ||
.... | ||
} | ||
*/ | ||
const inventedStation = getStationById('999999') | ||
console.log(inventedStation) // null | ||
``` | ||
## Built With | ||
@@ -63,0 +83,0 @@ |
const stations = require('./stations.json') | ||
const getStationById = id => { | ||
const selectedStation = stations.filter(station => { | ||
return id === station.id || parseInt(id) === parseInt(station.id) | ||
}) | ||
return selectedStation.length ? selectedStation[0] : null | ||
} | ||
module.exports = { | ||
getAll: () => stations | ||
getAll: () => stations, | ||
getStationById | ||
} |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
66811
932
115
0