mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
code style 👕, update deps, 1.2.1
This commit is contained in:
parent
dd7eef94ac
commit
83bf5c1b0a
2 changed files with 31 additions and 17 deletions
10
index.js
10
index.js
|
@ -23,10 +23,10 @@ const hafasError = (msg) => {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = (opt) => {
|
const createRequest = (opt) => {
|
||||||
opt = Object.assign({}, defaults, opt)
|
opt = Object.assign({}, defaults, opt)
|
||||||
|
|
||||||
return (data) => {
|
const request = (data) => {
|
||||||
const body = opt.onBody({lang: 'en', svcReqL: [data]})
|
const body = opt.onBody({lang: 'en', svcReqL: [data]})
|
||||||
const req = opt.onReq({
|
const req = opt.onReq({
|
||||||
json: true, body: JSON.stringify(body),
|
json: true, body: JSON.stringify(body),
|
||||||
|
@ -52,8 +52,10 @@ const request = (opt) => {
|
||||||
if (Array.isArray(c.remL)) d.remarks = c.remL.map(opt.onRemark)
|
if (Array.isArray(c.remL)) d.remarks = c.remL.map(opt.onRemark)
|
||||||
if (Array.isArray(c.opL)) d.operators = c.opL.map(opt.onOperator)
|
if (Array.isArray(c.opL)) d.operators = c.opL.map(opt.onOperator)
|
||||||
return d
|
return d
|
||||||
}).catch((err) => {throw err})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return request
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = request
|
module.exports = createRequest
|
||||||
|
|
38
package.json
38
package.json
|
@ -1,18 +1,30 @@
|
||||||
{
|
{
|
||||||
"name": "hafas-client",
|
"name": "hafas-client",
|
||||||
"description": "JavaScript client for HAFAS mobile APIs.",
|
"description": "JavaScript client for HAFAS mobile APIs.",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": ["index.js", "parse.js", "stringify.js"],
|
"files": [
|
||||||
"author": "Jannis R <mail@jannisr.de>",
|
"index.js",
|
||||||
"homepage": "https://github.com/derhuerst/hafas-client",
|
"parse.js",
|
||||||
"repository": "derhuerst/hafas-client",
|
"stringify.js"
|
||||||
"bugs": "https://github.com/derhuerst/hafas-client/issues",
|
],
|
||||||
"license": "ISC",
|
"author": "Jannis R <mail@jannisr.de>",
|
||||||
"keywords": ["hafas", "public", "transport", "api", "mgate"],
|
"homepage": "https://github.com/derhuerst/hafas-client",
|
||||||
"engines" : {"node": ">=6"},
|
"repository": "derhuerst/hafas-client",
|
||||||
|
"bugs": "https://github.com/derhuerst/hafas-client/issues",
|
||||||
|
"license": "ISC",
|
||||||
|
"keywords": [
|
||||||
|
"hafas",
|
||||||
|
"public",
|
||||||
|
"transport",
|
||||||
|
"api",
|
||||||
|
"mgate"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"got": "^6.7.1",
|
"got": "^7.1.0",
|
||||||
"moment-timezone": "^0.5.13",
|
"moment-timezone": "^0.5.13",
|
||||||
"slugg": "^1.2.0"
|
"slugg": "^1.2.0"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue