Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dtable-utils

Package Overview
Dependencies
Maintainers
0
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dtable-utils - npm Package Compare versions

Comparing version 5.0.11 to 5.0.12

36

es/cell-value-get/geolocation.js
import { GROUP_GEOLOCATION_GRANULARITY } from '../constants/group.js';
import { isValidPosition } from '../validate/geolocation.js';
var _convertLatitudeDecimalToDMS = function _convertLatitudeDecimalToDMS(latitudeDecimal) {
if (!latitudeDecimal && latitudeDecimal !== 0) return '';
if (latitudeDecimal < -90 || latitudeDecimal > 90) {
return '';
}
var degrees = Math.floor(Math.abs(latitudeDecimal));
var minutesDecimal = (Math.abs(latitudeDecimal) - degrees) * 60;
var minutes = Math.floor(minutesDecimal);
var seconds = Math.round((minutesDecimal - minutes) * 60);
var latitudeNS = latitudeDecimal >= 0 ? 'N' : 'S';
return "".concat(latitudeNS).concat(degrees, "\xB0").concat(minutes, "'").concat(seconds, "\"");
};
var _convertLongitudeDecimalToDMS = function _convertLongitudeDecimalToDMS(longitudeDecimal) {
if (!longitudeDecimal && longitudeDecimal !== 0) return '';
if (longitudeDecimal < -180 || longitudeDecimal > 180) {
return '';
}
var degrees = Math.floor(Math.abs(longitudeDecimal));
var minutesDecimal = (Math.abs(longitudeDecimal) - degrees) * 60;
var minutes = Math.floor(minutesDecimal);
var seconds = Math.round((minutesDecimal - minutes) * 60);
var longitudeNS = longitudeDecimal >= 0 ? 'E' : 'W';
return "".concat(longitudeNS).concat(degrees, "\xB0").concat(minutes, "'").concat(seconds, "\"");
};
/**

@@ -13,6 +38,5 @@ * Get formatted geolocation

var getGeolocationDisplayString = function getGeolocationDisplayString(loc, formats) {
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref$isBaiduMap = _ref.isBaiduMap,
isBaiduMap = _ref$isBaiduMap === void 0 ? true : _ref$isBaiduMap,
_ref$hyphen = _ref.hyphen,
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
_ref.isBaiduMap;
var _ref$hyphen = _ref.hyphen,
hyphen = _ref$hyphen === void 0 ? '' : _ref$hyphen;

@@ -28,3 +52,5 @@ if (!loc) return '';

if (!isValidPosition(lng, lat)) return '';
return isBaiduMap ? "".concat(lng, ", ").concat(lat) : "".concat(lat, ", ").concat(lng);
var lngDMS = _convertLongitudeDecimalToDMS(lng);
var latDMS = _convertLatitudeDecimalToDMS(lat);
return "".concat(latDMS, ", ").concat(lngDMS);
}

@@ -31,0 +57,0 @@ case 'country_region':

@@ -8,2 +8,27 @@ 'use strict';

var _convertLatitudeDecimalToDMS = function _convertLatitudeDecimalToDMS(latitudeDecimal) {
if (!latitudeDecimal && latitudeDecimal !== 0) return '';
if (latitudeDecimal < -90 || latitudeDecimal > 90) {
return '';
}
var degrees = Math.floor(Math.abs(latitudeDecimal));
var minutesDecimal = (Math.abs(latitudeDecimal) - degrees) * 60;
var minutes = Math.floor(minutesDecimal);
var seconds = Math.round((minutesDecimal - minutes) * 60);
var latitudeNS = latitudeDecimal >= 0 ? 'N' : 'S';
return "".concat(latitudeNS).concat(degrees, "\xB0").concat(minutes, "'").concat(seconds, "\"");
};
var _convertLongitudeDecimalToDMS = function _convertLongitudeDecimalToDMS(longitudeDecimal) {
if (!longitudeDecimal && longitudeDecimal !== 0) return '';
if (longitudeDecimal < -180 || longitudeDecimal > 180) {
return '';
}
var degrees = Math.floor(Math.abs(longitudeDecimal));
var minutesDecimal = (Math.abs(longitudeDecimal) - degrees) * 60;
var minutes = Math.floor(minutesDecimal);
var seconds = Math.round((minutesDecimal - minutes) * 60);
var longitudeNS = longitudeDecimal >= 0 ? 'E' : 'W';
return "".concat(longitudeNS).concat(degrees, "\xB0").concat(minutes, "'").concat(seconds, "\"");
};
/**

@@ -18,6 +43,5 @@ * Get formatted geolocation

var getGeolocationDisplayString = function getGeolocationDisplayString(loc, formats) {
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref$isBaiduMap = _ref.isBaiduMap,
isBaiduMap = _ref$isBaiduMap === void 0 ? true : _ref$isBaiduMap,
_ref$hyphen = _ref.hyphen,
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
_ref.isBaiduMap;
var _ref$hyphen = _ref.hyphen,
hyphen = _ref$hyphen === void 0 ? '' : _ref$hyphen;

@@ -33,3 +57,5 @@ if (!loc) return '';

if (!geolocation.isValidPosition(lng, lat)) return '';
return isBaiduMap ? "".concat(lng, ", ").concat(lat) : "".concat(lat, ", ").concat(lng);
var lngDMS = _convertLongitudeDecimalToDMS(lng);
var latDMS = _convertLatitudeDecimalToDMS(lat);
return "".concat(latDMS, ", ").concat(lngDMS);
}

@@ -36,0 +62,0 @@ case 'country_region':

2

package.json
{
"name": "dtable-utils",
"version": "5.0.11",
"version": "5.0.12",
"description": "dtable common utils",

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

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

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