From 83bf5c1b0a9f819b0704c6aad30c86785498e876 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 3 Oct 2017 17:36:42 +0200 Subject: [PATCH] code style :shirt:, update deps, 1.2.1 --- index.js | 10 ++++++---- package.json | 38 +++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index b84492ba..9ae6f877 100644 --- a/index.js +++ b/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 diff --git a/package.json b/package.json index e8b7bb94..a067333f 100644 --- a/package.json +++ b/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 ", - "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 ", + "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" },