mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59: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
|
||||
}
|
||||
|
||||
const request = (opt) => {
|
||||
const createRequest = (opt) => {
|
||||
opt = Object.assign({}, defaults, opt)
|
||||
|
||||
return (data) => {
|
||||
const request = (data) => {
|
||||
const body = opt.onBody({lang: 'en', svcReqL: [data]})
|
||||
const req = opt.onReq({
|
||||
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.opL)) d.operators = c.opL.map(opt.onOperator)
|
||||
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",
|
||||
"description": "JavaScript client for HAFAS mobile APIs.",
|
||||
"version": "1.2.0",
|
||||
"main": "index.js",
|
||||
"files": ["index.js", "parse.js", "stringify.js"],
|
||||
"author": "Jannis R <mail@jannisr.de>",
|
||||
"homepage": "https://github.com/derhuerst/hafas-client",
|
||||
"repository": "derhuerst/hafas-client",
|
||||
"bugs": "https://github.com/derhuerst/hafas-client/issues",
|
||||
"license": "ISC",
|
||||
"keywords": ["hafas", "public", "transport", "api", "mgate"],
|
||||
"engines" : {"node": ">=6"},
|
||||
"name": "hafas-client",
|
||||
"description": "JavaScript client for HAFAS mobile APIs.",
|
||||
"version": "1.2.1",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"parse.js",
|
||||
"stringify.js"
|
||||
],
|
||||
"author": "Jannis R <mail@jannisr.de>",
|
||||
"homepage": "https://github.com/derhuerst/hafas-client",
|
||||
"repository": "derhuerst/hafas-client",
|
||||
"bugs": "https://github.com/derhuerst/hafas-client/issues",
|
||||
"license": "ISC",
|
||||
"keywords": [
|
||||
"hafas",
|
||||
"public",
|
||||
"transport",
|
||||
"api",
|
||||
"mgate"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"dependencies": {
|
||||
"got": "^6.7.1",
|
||||
"got": "^7.1.0",
|
||||
"moment-timezone": "^0.5.13",
|
||||
"slugg": "^1.2.0"
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue