added all files to project

This commit is contained in:
2022-03-10 10:36:59 +01:00
parent 09dd957b33
commit 46a936d7de
25351 changed files with 3883356 additions and 0 deletions
@@ -0,0 +1,17 @@
'use strict'
const to12Digit = (id) => {
if ('string' !== typeof id) throw new Error('ID must be a string.')
if (id.length === 9) return id.slice(0, 1) + '000' + id.slice(1)
if (id.length === 7) return id.slice(0, 1) + '00000' + id.slice(1)
return id
}
const to9Digit = (twelve) => {
if ('string' !== typeof twelve) throw new Error('ID must be a string.')
if (twelve.length === 12) return twelve.slice(0, 1) + twelve.slice(4)
if (twelve.length === 7) return twelve.slice(0, 1) + '00' + twelve.slice(1)
return twelve
}
module.exports = {to12Digit, to9Digit}
@@ -0,0 +1,5 @@
Copyright (c) 2020, Jannis R
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,62 @@
{
"_from": "vbb-translate-ids@^4.0.0",
"_id": "vbb-translate-ids@4.0.0",
"_inBundle": false,
"_integrity": "sha512-acc8aCheKRO10vEMIN7a/1chAkD30sW28MUkLbylOtCHD7aGOTGnB6ztGeszFER8qpx915pMyoWggGteF4vB3g==",
"_location": "/vbb-translate-ids",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "vbb-translate-ids@^4.0.0",
"name": "vbb-translate-ids",
"escapedName": "vbb-translate-ids",
"rawSpec": "^4.0.0",
"saveSpec": null,
"fetchSpec": "^4.0.0"
},
"_requiredBy": [
"/hafas-client"
],
"_resolved": "https://registry.npmjs.org/vbb-translate-ids/-/vbb-translate-ids-4.0.0.tgz",
"_shasum": "11e6a045055c2d10e3fd3a30189bd00b2d7272dd",
"_spec": "vbb-translate-ids@^4.0.0",
"_where": "/home/pi/MagicMirror/modules/MMM-PublicTransportHafas/node_modules/hafas-client",
"author": {
"name": "Jannis R",
"email": "mail@jannisr.de"
},
"bugs": {
"url": "https://github.com/derhuerst/vbb-lines/issues-at"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Translate VBB IDs from 9-digit to 12-digit and reverse.",
"engines": {
"node": ">=6"
},
"files": [
"index.js"
],
"homepage": "https://github.com/derhuerst/vbb-translate-ids",
"keywords": [
"vbb",
"stations",
"ids",
"new",
"ids",
"international"
],
"license": "ISC",
"main": "index.js",
"name": "vbb-translate-ids",
"repository": {
"type": "git",
"url": "git+https://github.com/derhuerst/vbb-translate-ids.git"
},
"scripts": {
"prepublishOnly": "npm test",
"test": "node test.js"
},
"version": "4.0.0"
}
@@ -0,0 +1,32 @@
# vbb-translate-ids
**Translate VBB IDs from 9-digit to 12-digit and reverse.**
[![npm version](https://img.shields.io/npm/v/vbb-translate-ids.svg)](https://www.npmjs.com/package/vbb-translate-ids)
[![build status](https://img.shields.io/travis/derhuerst/vbb-translate-ids.svg)](https://travis-ci.org/derhuerst/vbb-translate-ids)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/vbb-translate-ids.svg)
[![gitter channel](https://badges.gitter.im/derhuerst/vbb-rest.svg)](https://gitter.im/derhuerst/vbb-rest)
## Installing
```shell
npm install vbb-translate-ids
```
## Usage
```js
const {to12Digit, to9Digit} = require('vbb-translate-ids')
assert.strictEqual(to12Digit('900003201'), '900000003201')
assert.strictEqual(to9Digit('900000003201'), '900003201')
```
If `to12Digit`/`to9Digit` don't know how to translate the ID, they will just return it.
## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/vbb-translate-ids/issues).