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

apis-car

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apis-car - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

63

index.js

@@ -1,49 +0,24 @@

var request = require('request'),
cheerio = require('cheerio'),
h = require('apis-helpers');
var parser = require('apis-parser');
exports.setup = function (app) {
app.get('/is/:id', function (req, callback) {
lookupIceland(req.params.id, callback)
});
};
module.exports = function(app,prefix){
<<<<<<< HEAD
var car = require('car');
var lookupIceland = exports.is = function (carPlate, callback) {
app.get(prefix + '/is',function(req,res){
parser(res)(function(cb){
car.is(req.query.number, cb);
=======
var firm = require('firm');
if (!carPlate.match(/^[a-z0-9]+$/ig)) {
return callback(new Error('Invalid license plate'));
}
request.get({
headers: {
'User-Agent': h.browser()
},
url: 'http://ww2.us.is/upplysingar_um_bil?vehinumber=' + carPlate
}, function (error, response, body) {
if (error || response.statusCode !== 200) {
return callback(new Error('www.us.is refuses to respond or give back data'));
}
var $ = cheerio.load(body),
obj = {
results: []
},
car = {};
var fields = ['registryNumber', 'number', 'factoryNumber', 'type', 'subType', 'color', 'registeredAt', 'status', 'nextCheck', 'pollution', 'weight'];
var nothingFound = $('table tr td').html();
if (nothingFound.indexOf('Ekkert ökutæki fannst') > -1) {
var err = new Error('Not found');
err.code = 404;
return callback(err);
}
//Found something
$('table tr').each(function (key) {
var val = $(this).find('b').html();
if (val != '' && val != 0) { //Perform check and add to car array if it passes
car[fields[key]] = val;
}
app.get(prefix + '/is',function(req,res){
parser(res)(function(cb){
firm.is({
name: req.query.name,
address: req.query.address,
socialnumber: req.query.socialnumber,
vsknr: req.query.vasknr
}, cb);
>>>>>>> c39ca6593145338ca1f64b7ac0e4ab0139aa030f
});
return callback(null, car);
});
};
}
{
"name": "apis-car",
"version": "0.1.0",
"author": {
"name": "Kristján Ingi Mikaelsson",
"email": "kristjanmik@gmail.com"
},
"contributors": [{
"name": "Kristjan Broder Lund",
"email": "kristjan.1234@gmail.com"
}],
"description": "An library to look up license plates of cars",
"repository": {
"type": "git",
"url": "https://github.com/kristjanmik/apis-car.git"
},
"dependencies": {
"apis-helpers": "~0.0.1",
"request": "~2.30.0",
"cheerio": "~0.13.0"
}
"name": "apis-car",
"version": "0.1.1",
"author": {
"name": "Kristján Ingi Mikaelsson",
"email": "kristjanmik@gmail.com"
},
"description": "A wrapper around the car module for the apis.is platform",
"repository": {
"type": "git",
"url": "https://github.com/kristjanmik/apis-car.git"
},
"dependencies": {
"car": "~0.1.1",
"apis-parser": "~0.1.0"
}
}

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