nearby-sort
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -17,2 +17,9 @@ # CHANGELOG | ||
## v1.1.0 | ||
#### Performance Improvements | ||
- Structural improvements | ||
- Performance improvements | ||
## v1.0.1 | ||
@@ -28,2 +35,2 @@ | ||
- **Initial Release**: Setup ESLint Action | ||
- **Initial Release**: Setup ESLint Action |
@@ -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=({lat:t,long:a},n,o=!0)=>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 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}; | ||
//# sourceMappingURL=sort.modern.js.map |
@@ -1,2 +0,2 @@ | ||
var r=function(r,t,a,o){var e=n(a-r),u=n(o-t),h=Math.sin(e/2)*Math.sin(e/2)+Math.cos(n(r))*Math.cos(n(a))*Math.sin(u/2)*Math.sin(u/2);return 2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))*6371},n=function(r){return r*(Math.PI/180)},t=function(n,t,a){var o=n.lat,e=n.long;return void 0===a&&(a=!0),new Promise(function(n,u){try{!function(r,n,t,a){if(!r||!n||!t)throw new Error("Invalid arguments");if("number"!=typeof r||"number"!=typeof n)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 a)throw new Error("Asc argument should be a boolean")}(o,e,t,a),n(t.sort(function(n,t){var u=r(o,e,n.lat,n.long),h=r(o,e,t.lat,t.long);return a?u-h:h-u}))}catch(r){u(r)}})};export{t as default}; | ||
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}; | ||
//# sourceMappingURL=sort.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n||self).nearbySort=t()}(this,function(){var n=function(n,r,o,e){var a=t(o-n),i=t(e-r),u=Math.sin(a/2)*Math.sin(a/2)+Math.cos(t(n))*Math.cos(t(o))*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))*6371},t=function(n){return n*(Math.PI/180)};return function(t,r,o){var e=t.lat,a=t.long;return void 0===o&&(o=!0),new Promise(function(t,i){try{!function(n,t,r,o){if(!n||!t||!r)throw new Error("Invalid arguments");if("number"!=typeof n||"number"!=typeof t)throw new Error("lat and long should be numbers");if(!Array.isArray(r))throw new Error("Second argument should be an array");if("boolean"!=typeof o)throw new Error("Asc argument should be a boolean")}(e,a,r,o),t(r.sort(function(t,r){var i=n(e,a,t.lat,t.long),u=n(e,a,r.lat,r.long);return o?i-u:u-i}))}catch(n){i(n)}})}}); | ||
!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)}}}); | ||
//# sourceMappingURL=sort.umd.js.map |
{ | ||
"name": "nearby-sort", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "The library to sort array of objects by distance from a given point", | ||
"type": "module", | ||
"source": "src/index.js", | ||
"source": "src/index.ts", | ||
"exports": { | ||
@@ -14,4 +14,5 @@ "require": "./dist/sort.cjs", | ||
"unpkg": "./dist/sort.umd.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "microbundle", | ||
"build": "rm -rf ./dist && microbundle --tsconfig ./tsconfig.json", | ||
"dev": "microbundle watch", | ||
@@ -41,6 +42,12 @@ "prepare": "husky install", | ||
"@commitlint/cli": "^17.1.2", | ||
"@types/jest": "^29.2.5", | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"commitlint-config-non-conventional": "^1.0.1", | ||
"eslint": "^8.24.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-standard-with-typescript": "^24.0.0", | ||
"eslint-plugin-import": "^2.25.2", | ||
"eslint-plugin-n": "^15.0.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"husky": "^8.0.0", | ||
@@ -51,4 +58,6 @@ "jest": "^29.3.1", | ||
"prettier": "^2.7.1", | ||
"pretty-quick": "^3.1.3" | ||
"pretty-quick": "^3.1.3", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "*" | ||
} | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29244
32
139
19