https://github.com/juliuste/is-uic-location-code
Check if given value is a valid UIC location code.
https://github.com/juliuste/is-uic-location-code
library public-transport railway
Last synced: 8 months ago
JSON representation
Check if given value is a valid UIC location code.
- Host: GitHub
- URL: https://github.com/juliuste/is-uic-location-code
- Owner: juliuste
- License: isc
- Created: 2018-11-02T03:44:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-25T04:13:26.000Z (about 6 years ago)
- Last Synced: 2025-01-26T03:47:55.994Z (over 1 year ago)
- Topics: library, public-transport, railway
- Language: JavaScript
- Size: 40 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# is-uic-location-code
Check if given value is a valid [UIC location code (ENEE)](https://uic.org/location-codes-enee). Uses the [`uic-codes`](https://github.com/derhuerst/uic-codes) package. Note that only 7-character codes are considered valid for now (instead of 8-digit with checksum, as specified by UIC), because most operators don't provide it, so that 8-digit codes are more likely the result of bugs or inconsistencies.
[](https://www.npmjs.com/package/is-uic-location-code)
[](https://travis-ci.org/juliuste/is-uic-location-code)
[](https://greenkeeper.io/)
[](https://david-dm.org/juliuste/is-uic-location-code)
[](license)
[](https://gitter.im/juliuste)
## Installation
```bash
npm install is-uic-location-code
```
## Usage
```js
const isUicLocationCode = require('is-uic-location-code')
isUicLocationCode('1000010') // true
isUicLocationCode('8000001') // true
isUicLocationCode('8777777') // true
isUicLocationCode(8777777) // false
isUicLocationCode('80-00001') // false
isUicLocationCode('800000001') // false
isUicLocationCode('0010000') // false
isUicLocationCode('80') // false
isUicLocationCode(null) // false
isUicLocationCode(undefined) // false
```
## Contributing
If you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/is-uic-location-code/issues).