Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,29 @@ | ||
#### 2.0.2 (2017-6-19) | ||
##### Chores | ||
* **package:** | ||
* update dependencies ([4c2b2d88](https://github.com/lgaticaq/bip/commit/4c2b2d88cddc42f15138f6aa68efc05f9c087749)) | ||
* update eslint to version 4.0.0 ([13a7e85e](https://github.com/lgaticaq/bip/commit/13a7e85e134f833b698b37bfa0fc293f2b38efa6)) | ||
* update codeclimate-test-reporter to version 0.5.0 ([b59c8160](https://github.com/lgaticaq/bip/commit/b59c81609f5c977b7009ca84167ee944b6e61ca4)) | ||
* update chai to version 4.0.0 ([752e0607](https://github.com/lgaticaq/bip/commit/752e0607ae3a78cca4283abd22a110e3f6042f37)) | ||
* Upgrade coveralls, eslint and nock ([007aa61e](https://github.com/lgaticaq/bip/commit/007aa61e366b46f5403dcc153c5cc2f2b2a66087)) | ||
* Upgrade nock to version 9.0.9 ([6e355ade](https://github.com/lgaticaq/bip/commit/6e355ade6e7045f1c3135c6fd5984f2fd6e355f3)) | ||
* Upgrade eslint to version 3.18.0 ([0e70bd96](https://github.com/lgaticaq/bip/commit/0e70bd96b3c56b331253a2718fdc9c354f101372)) | ||
* Upgrade coveralls to version 2.12.0 ([37dbb8b9](https://github.com/lgaticaq/bip/commit/37dbb8b996b85325d281b94b837b885fa1032381)) | ||
* Upgrade codeclimate-test-reporter to version 0.4.1 ([e8461e86](https://github.com/lgaticaq/bip/commit/e8461e86a310ea355298315a8d758f0e9668bfab)) | ||
* update nock to version 9.0.9 ([f54ff103](https://github.com/lgaticaq/bip/commit/f54ff103c137787b8e0368265d409d1f67316bd2)) | ||
* Update eslint to v3.14.1 ([7f22cb9b](https://github.com/lgaticaq/bip/commit/7f22cb9b1f3a77de42f6a5b52c8bba23beeafa21)) | ||
* Update dependencies ([3a545427](https://github.com/lgaticaq/bip/commit/3a5454277ccffb4f1cc9302d7a6ed1d59ca36bd4)) | ||
* **travis:** Add cache yarn ([528079bb](https://github.com/lgaticaq/bip/commit/528079bb75e62483f08af100ab2289bc0d8add8b)) | ||
* **npm:** Update ignore ([baad42e8](https://github.com/lgaticaq/bip/commit/baad42e8148fad2e24382391819a592c80afd286)) | ||
##### Documentation Changes | ||
* **LICENSE:** Update year ([11358152](https://github.com/lgaticaq/bip/commit/113581520947c6bde4d9312449c6d4244dac2bc0)) | ||
##### Bug Fixes | ||
* **linter:** Fix Arrow function should not return assignment ([0b5ce9a4](https://github.com/lgaticaq/bip/commit/0b5ce9a441ad78d3460f8864321f66d79d040e14)) | ||
#### 2.0.1 (2016-11-27) | ||
@@ -2,0 +30,0 @@ |
{ | ||
"name": "bip", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Get balance of bip card (Chile)", | ||
"main": "src", | ||
"scripts": { | ||
"pretest": "eslint .", | ||
"lint": "eslint .", | ||
"format": "prettier-standard 'src/**/*.js' 'test/**/*.js'", | ||
"precommit": "lint-staged", | ||
"pretest": "npm run lint -s && npm run format -s", | ||
"test": "istanbul cover _mocha", | ||
"coveralls": "coveralls < coverage/lcov.info", | ||
"codeclimate": "codeclimate-test-reporter < coverage/lcov.info", | ||
"release:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags && npm publish", | ||
@@ -16,3 +17,3 @@ "release:minor": "changelog -m && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version minor && git push origin && git push origin --tags && npm publish", | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=6" | ||
}, | ||
@@ -36,38 +37,46 @@ "repository": { | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"codeclimate-test-reporter": "^0.4.0", | ||
"coveralls": "^2.11.15", | ||
"eslint": "^3.11.0", | ||
"generate-changelog": "^1.0.2", | ||
"chai": "^4.0.2", | ||
"eslint": "^4.0.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-import": "^2.3.0", | ||
"eslint-plugin-node": "^5.0.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"generate-changelog": "^1.2.1", | ||
"husky": "^0.13.4", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0", | ||
"nock": "^9.0.2" | ||
"lint-staged": "^4.0.0", | ||
"mocha": "^3.4.2", | ||
"nock": "^9.0.13", | ||
"prettier-standard": "^5.1.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "standard", | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
"mocha": true, | ||
"es6": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"indent": [ | ||
2, | ||
2 | ||
], | ||
"linebreak-style": [ | ||
2, | ||
"unix" | ||
], | ||
"quotes": [ | ||
2, | ||
"single" | ||
], | ||
"semi": [ | ||
2, | ||
"always" | ||
"no-console": [ | ||
"error" | ||
] | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/**/*.js": [ | ||
"eslint --fix", | ||
"prettier-standard", | ||
"git add" | ||
], | ||
"test/**/*.js": [ | ||
"eslint --fix", | ||
"prettier-standard", | ||
"git add" | ||
] | ||
}, | ||
"tonicExampleFilename": "example.js" | ||
} |
@@ -1,27 +0,35 @@ | ||
'use strict'; | ||
'use strict' | ||
const http = require('http'); | ||
const http = require('http') | ||
module.exports = number => { | ||
return new Promise((resolve, reject) => { | ||
const url = `http://www.metrosantiago.cl/contents/guia-viajero/includes/consultarTarjeta/${number}`; | ||
http.get(url, res => { | ||
const options = { | ||
hostname: 'www.metrosantiago.cl', | ||
port: 80, | ||
path: `/contents/guia-viajero/includes/consultarTarjeta/${number}`, | ||
method: 'GET' | ||
} | ||
const req = http.request(options, res => { | ||
if (res.statusCode !== 200) { | ||
res.resume(); | ||
reject(new Error(`Request Failed. Status Code: ${res.statusCode}`)); | ||
reject(new Error(`Request Failed. Status Code: ${res.statusCode}`)) | ||
} else { | ||
res.setEncoding('utf8'); | ||
let rawData = ''; | ||
res.on('data', chunk => rawData += chunk); | ||
res.setEncoding('utf8') | ||
let rawData = '' | ||
res.on('data', chunk => { | ||
rawData += chunk | ||
}) | ||
res.on('end', () => { | ||
try { | ||
const data = JSON.parse(rawData); | ||
if (data.length === 0) reject(Error('Not found')); | ||
if (data[0].estado !== 0) reject(Error(data[0].mensaje)); | ||
const balance = parseInt(data[1].saldo || 0, 10); | ||
let date = null; | ||
const data = JSON.parse(rawData) | ||
if (data.length === 0) reject(Error('Not found')) | ||
if (data[0].estado !== 0) reject(Error(data[0].mensaje)) | ||
const balance = parseInt(data[1].saldo || 0, 10) | ||
let date = null | ||
if (data[1].fecha) { | ||
const iso = data[1].fecha.replace( | ||
/(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})/, '$3-$2-$1T$4:$5:00-03:00'); | ||
date = new Date(iso); | ||
/(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2})/, | ||
'$3-$2-$1T$4:$5:00-03:00' | ||
) | ||
date = new Date(iso) | ||
} | ||
@@ -34,10 +42,12 @@ resolve({ | ||
valid: data[1].salida | ||
}); | ||
}) | ||
} catch (err) { | ||
reject(err); | ||
reject(err) | ||
} | ||
}); | ||
}) | ||
} | ||
}).on('error', err => reject(err)); | ||
}); | ||
}; | ||
}) | ||
req.on('error', err => reject(err)) | ||
req.end() | ||
}) | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12115
7
53
1
14