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

country-timezone

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-timezone - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

test.js

2

package.json
{
"name": "country-timezone",
"version": "1.0.4",
"version": "1.0.5",
"description": "Find timezone based on country code or country name.",

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

# country-timezone
Find timezone based on country IOS code or country name
Find timezone with country code and country name
#### Install
```
npm install country-timezone --save
```
OR install with yarn
```
yarn add country-timezone
```
#### Get time with country name and country code
```
import countryTimezone from 'country-timezone';
const timezonesWithName = countryTimezone.getTimezonesWithCountryName('India');
const timezonesWithCode = countryTimezone.getTimezonesWithCountryCode('IN');
console.log(timezonesWithName, timezonesWithCode);
// [ 'Asia/Kolkata' ] [ 'Asia/Kolkata' ]
```

@@ -10,4 +10,11 @@ var rawData = require('./data.json');

const matchedCountry = countries.find(function(country) {
const removedSpaceName = name.replace(/^\s+|\s+$/g, '');
return country.name.toLowerCase() === removedSpaceName.toLowerCase()
const lowerCountryName = country.name.toLowerCase().trim()
const userEnteredCountryName = removedSpaceName.toLowerCase()
// If user has entered both country name and city name together
const nameSplit = name.toLowerCase().split(' ')
return lowerCountryName === userEnteredCountryName || nameSplit.includes(lowerCountryName)
})

@@ -14,0 +21,0 @@

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