New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sptrans-promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sptrans-promise - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

build/server/helpers/buildLinhasResponse.js

6

build/server/auth.js

@@ -7,2 +7,6 @@ 'use strict';

var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _axios = require('axios');

@@ -64,3 +68,3 @@

exports.default = function (token) {
return Promise.resolve(token).then(checkIfHasToken).then(fetchData).catch(handleError);
return _promise2.default.resolve(token).then(checkIfHasToken).then(fetchData);
};

3

build/server/constants/api.js

@@ -7,4 +7,5 @@ 'use strict';

exports.default = {
localhost: 'http://localhost:8888',
endpoint: 'http://api.olhovivo.sptrans.com.br/v0',
heroku: 'https://sptrans-server.herokuapp.com/sptrans',
heroku: 'https://sptrans-server.herokuapp.com',
auth: {

@@ -11,0 +12,0 @@ route: '/login/autenticar',

@@ -7,2 +7,14 @@ 'use strict';

var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _assign = require('babel-runtime/core-js/object/assign');
var _assign2 = _interopRequireDefault(_assign);
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _axios = require('axios');

@@ -14,6 +26,6 @@

var _helpers = require('./helpers');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var isBrowser = typeof window !== 'undefined';

@@ -61,3 +73,3 @@

return paramValue.map(function (value) {
return _defineProperty({}, cur, value);
return (0, _defineProperty3.default)({}, cur, value);
});

@@ -70,3 +82,3 @@ }

var params = requiredParams.reduce(build, {});
return Object.assign(options, { params: params });
return (0, _assign2.default)(options, { params: params });
}

@@ -79,3 +91,6 @@

function handleResponse(res) {
function handleResponse(res, options) {
if (options.tipo === 'linhas') {
return (0, _helpers.buildLinhasResponse)(res.data);
}
return res.data;

@@ -93,4 +108,4 @@ }

headers = null;
url = _constants.API.heroku;
Object.assign(params, {
url = _constants.API.heroku + '/find';
(0, _assign2.default)(params, {
auth: options.auth,

@@ -112,3 +127,3 @@ route: _constants.API[options.tipo].route

var promises = options.params.map(buildPromise);
return Promise.all(promises).then(function (res) {
return _promise2.default.all(promises).then(function (res) {
return res.map(validateHttpStatus);

@@ -120,7 +135,9 @@ }).then(function (res) {

return buildPromise(options.params).then(validateHttpStatus).then(handleResponse);
return buildPromise(options.params).then(validateHttpStatus).then(function (res) {
return handleResponse(res, options);
});
}
exports.default = function (options) {
return Promise.resolve(options).then(hasOptions).then(hasAuth).then(isAllowedType).then(hasRequiredParams).then(buildParams).then(fetchData);
return _promise2.default.resolve(options).then(hasOptions).then(hasAuth).then(isAllowedType).then(hasRequiredParams).then(buildParams).then(fetchData);
};

@@ -5,3 +5,3 @@ {

"description": "Busca informações em tempo real da frota de ônibus da SPTrans na cidade de São Paulo.",
"version": "1.0.3",
"version": "1.0.4",
"license": "MIT",

@@ -30,2 +30,4 @@ "main": "build/server/index.js",

"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",

@@ -40,7 +42,15 @@ "babelify": "^7.3.0",

"dependencies": {
"axios": "^0.16.0"
"axios": "^0.16.0",
"babel-runtime": "^6.23.0"
},
"ava": {
"babel": {
"presets": [
"es2015",
"@ava/stage-4"
]
},
"require": [
"babel-register"
"babel-register",
"babel-polyfill"
]

@@ -47,0 +57,0 @@ },

@@ -76,3 +76,3 @@ <h1 align="center">SPTrans Promise</h1>

const encontrarLinhas = auth => {
function encontrarLinhas (auth) {
sptrans.find({

@@ -88,12 +88,3 @@ auth,

```
O parâmetro `termosBusca` também aceita um `array` de `strings` para buscar várias linhas ao mesmo tempo. Exemplo:
``` js
sptrans.find({
auth,
tipo: 'linhas',
termosBusca: ['Term. Lapa', 'Term. Pirituba']
}).then(console.log)
```
#### Paradas

@@ -100,0 +91,0 @@ O tipo `paradas` possibilita a consulta pelos pontos de parada da cidade de São Paulo.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc