Socket
Socket
Sign inDemoInstall

pmj-static-data

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.6

29

dist/index.js

@@ -10,2 +10,7 @@ "use strict";

const phone_numbers_1 = require("./data/phone-numbers");
function countMatches(searchTerm, text) {
const regex = new RegExp(searchTerm, "gi");
const matches = text.match(regex);
return matches ? matches.length : 0;
}
function GetAllCountriesPhoneCodes() {

@@ -79,8 +84,8 @@ let data = [];

return { airports: airports.sort((a, b) => {
const aMatchCount = a?.iata_code?.toLowerCase() === query?.toLowerCase() || a?.city_name?.toLowerCase() === query?.toLowerCase();
const bMatchCount = b?.iata_code?.toLowerCase() === query?.toLowerCase() || b?.city_name?.toLowerCase() === query?.toLowerCase();
if (bMatchCount) {
const aMatchCount = countMatches(query, a);
const bMatchCount = countMatches(query, b);
if (aMatchCount > bMatchCount) {
return -1;
}
else if (aMatchCount) {
else if (aMatchCount < bMatchCount) {
return 1;

@@ -92,8 +97,8 @@ }

}).slice(0, limit || 10), cities: cities.sort((a, b) => {
const aMatchCount = a?.iata_code?.toLowerCase() === query?.toLowerCase() || a?.city_name?.toLowerCase() === query?.toLowerCase();
const bMatchCount = b?.iata_code?.toLowerCase() === query?.toLowerCase() || b?.city_name?.toLowerCase() === query?.toLowerCase();
if (bMatchCount) {
const aMatchCount = countMatches(query, a);
const bMatchCount = countMatches(query, b);
if (aMatchCount > bMatchCount) {
return -1;
}
else if (aMatchCount) {
else if (aMatchCount < bMatchCount) {
return 1;

@@ -216,8 +221,8 @@ }

return cities.sort((a, b) => {
const aMatchCount = a?.iata_code?.toLowerCase() === query?.toLowerCase() || a?.city_name?.toLowerCase() === query?.toLowerCase();
const bMatchCount = b?.iata_code?.toLowerCase() === query?.toLowerCase() || b?.city_name?.toLowerCase() === query?.toLowerCase();
if (bMatchCount) {
const aMatchCount = countMatches(query, a);
const bMatchCount = countMatches(query, b);
if (aMatchCount > bMatchCount) {
return -1;
}
else if (aMatchCount) {
else if (aMatchCount < bMatchCount) {
return 1;

@@ -224,0 +229,0 @@ }

{
"name": "pmj-static-data",
"version": "1.0.4",
"version": "1.0.6",
"description": "Search Airports, Cities, Countries and many other data in Plan My Journey DATABASE.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc