code style 👕, update deps, 1.2.1

This commit is contained in:
Jannis R 2017-10-03 17:36:42 +02:00
parent dd7eef94ac
commit 83bf5c1b0a
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 31 additions and 17 deletions

View file

@ -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

View file

@ -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"
}, },