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

nearby-sort

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nearby-sort - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

6

CHANGELOGS.md

@@ -17,2 +17,8 @@ # CHANGELOG

## v1.1.1
#### Bug Fixes
- Fixed the issue where it fails to validate the lat/long with value 0
## v1.1.0

@@ -19,0 +25,0 @@

2

dist/sort.modern.js

@@ -1,2 +0,2 @@

const r=(r,a,n,o)=>{const e=t(n-r),s=t(o-a),h=Math.sin(e/2)*Math.sin(e/2)+Math.cos(t(r))*Math.cos(t(n))*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))*6371},t=r=>r*(Math.PI/180),a=async({lat:t,long:a},n,o=!0)=>await new Promise((e,s)=>{try{((r,t,a,n)=>{if(!r||!t||!a)throw new Error("Invalid arguments");if("number"!=typeof r||"number"!=typeof t)throw new Error("lat and long should be numbers");if(!Array.isArray(a))throw new Error("Second argument should be an array");if("boolean"!=typeof n)throw new Error("Asc argument should be a boolean")})(t,a,n,o),e(n.sort((n,e)=>{const s=r(t,a,n.lat,n.long),h=r(t,a,e.lat,e.long);return o?s-h:h-s}))}catch(r){s(r)}});export{a as default};
const a=(a,t,o,n)=>{const e=r(o-a),s=r(n-t),h=Math.sin(e/2)*Math.sin(e/2)+Math.cos(r(a))*Math.cos(r(o))*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))*6371},r=a=>a*(Math.PI/180),t=async({lat:r,long:t},o,n=!0)=>await new Promise((e,s)=>{try{((a,r,t,o)=>{if(isNaN(parseFloat(a))||isNaN(parseFloat(r))||!t)throw new Error("Invalid arguments");if("number"!=typeof a||"number"!=typeof r)throw new Error("lat and long should be numbers");if(!Array.isArray(t))throw new Error("Second argument should be an array");if("boolean"!=typeof o)throw new Error("Asc argument should be a boolean")})(r,t,o,n),e(o.sort((o,e)=>{const s=a(r,t,o.lat,o.long),h=a(r,t,e.lat,e.long);return n?s-h:h-s}))}catch(a){s(a)}});export{t as default};
//# sourceMappingURL=sort.modern.js.map

@@ -1,2 +0,2 @@

var r=function(r,n,o,a){var e=t(o-r),s=t(a-n),u=Math.sin(e/2)*Math.sin(e/2)+Math.cos(t(r))*Math.cos(t(o))*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))*6371},t=function(r){return r*(Math.PI/180)},n=function(t,n,o){var a=t.lat,e=t.long;void 0===o&&(o=!0);try{return Promise.resolve(new Promise(function(t,s){try{!function(r,t,n,o){if(!r||!t||!n)throw new Error("Invalid arguments");if("number"!=typeof r||"number"!=typeof t)throw new Error("lat and long should be numbers");if(!Array.isArray(n))throw new Error("Second argument should be an array");if("boolean"!=typeof o)throw new Error("Asc argument should be a boolean")}(a,e,n,o),t(n.sort(function(t,n){var s=r(a,e,t.lat,t.long),u=r(a,e,n.lat,n.long);return o?s-u:u-s}))}catch(r){s(r)}}))}catch(r){return Promise.reject(r)}};export{n as default};
var r=function(r,a,n,o){var e=t(n-r),s=t(o-a),i=Math.sin(e/2)*Math.sin(e/2)+Math.cos(t(r))*Math.cos(t(n))*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371},t=function(r){return r*(Math.PI/180)},a=function(t,a,n){var o=t.lat,e=t.long;void 0===n&&(n=!0);try{return Promise.resolve(new Promise(function(t,s){try{!function(r,t,a,n){if(isNaN(parseFloat(r))||isNaN(parseFloat(t))||!a)throw new Error("Invalid arguments");if("number"!=typeof r||"number"!=typeof t)throw new Error("lat and long should be numbers");if(!Array.isArray(a))throw new Error("Second argument should be an array");if("boolean"!=typeof n)throw new Error("Asc argument should be a boolean")}(o,e,a,n),t(a.sort(function(t,a){var s=r(o,e,t.lat,t.long),i=r(o,e,a.lat,a.long);return n?s-i:i-s}))}catch(r){s(r)}}))}catch(r){return Promise.reject(r)}};export{a as default};
//# sourceMappingURL=sort.module.js.map

@@ -1,2 +0,2 @@

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n||self).nearbySort=r()}(this,function(){var n=function(n,t,e,o){var a=r(e-n),i=r(o-t),u=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r(n))*Math.cos(r(e))*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))*6371},r=function(n){return n*(Math.PI/180)};return function(r,t,e){var o=r.lat,a=r.long;void 0===e&&(e=!0);try{return Promise.resolve(new Promise(function(r,i){try{!function(n,r,t,e){if(!n||!r||!t)throw new Error("Invalid arguments");if("number"!=typeof n||"number"!=typeof r)throw new Error("lat and long should be numbers");if(!Array.isArray(t))throw new Error("Second argument should be an array");if("boolean"!=typeof e)throw new Error("Asc argument should be a boolean")}(o,a,t,e),r(t.sort(function(r,t){var i=n(o,a,r.lat,r.long),u=n(o,a,t.lat,t.long);return e?i-u:u-i}))}catch(n){i(n)}}))}catch(n){return Promise.reject(n)}}});
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r||self).nearbySort=t()}(this,function(){var r=function(r,n,e,o){var a=t(e-r),i=t(o-n),s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(t(r))*Math.cos(t(e))*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6371},t=function(r){return r*(Math.PI/180)};return function(t,n,e){var o=t.lat,a=t.long;void 0===e&&(e=!0);try{return Promise.resolve(new Promise(function(t,i){try{!function(r,t,n,e){if(isNaN(parseFloat(r))||isNaN(parseFloat(t))||!n)throw new Error("Invalid arguments");if("number"!=typeof r||"number"!=typeof t)throw new Error("lat and long should be numbers");if(!Array.isArray(n))throw new Error("Second argument should be an array");if("boolean"!=typeof e)throw new Error("Asc argument should be a boolean")}(o,a,n,e),t(n.sort(function(t,n){var i=r(o,a,t.lat,t.long),s=r(o,a,n.lat,n.long);return e?i-s:s-i}))}catch(r){i(r)}}))}catch(r){return Promise.reject(r)}}});
//# sourceMappingURL=sort.umd.js.map
{
"name": "nearby-sort",
"version": "1.1.0",
"version": "1.1.1",
"description": "The library to sort array of objects by distance from a given point",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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