From 9a6155973bf7e96da15d84faeee33a978ed70c1d Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 18 Jan 2024 12:36:04 +0800 Subject: [PATCH] cleaned up linter, removed `extractLatitude()` and `extractLongitude()` utility --- addon/services/session.js | 2 +- addon/utils/extract-latitude.js | 25 ---------------------- addon/utils/extract-longitude.js | 25 ---------------------- app/utils/extract-latitude.js | 1 - app/utils/extract-longitude.js | 1 - tests/unit/utils/extract-latitude-test.js | 10 --------- tests/unit/utils/extract-longitude-test.js | 10 --------- 7 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 addon/utils/extract-latitude.js delete mode 100644 addon/utils/extract-longitude.js delete mode 100644 app/utils/extract-latitude.js delete mode 100644 app/utils/extract-longitude.js delete mode 100644 tests/unit/utils/extract-latitude-test.js delete mode 100644 tests/unit/utils/extract-longitude-test.js diff --git a/addon/services/session.js b/addon/services/session.js index 745c0d1..3758124 100644 --- a/addon/services/session.js +++ b/addon/services/session.js @@ -224,7 +224,7 @@ export default class SessionService extends SimpleAuthSessionService { * * @param {String} identity * @return {Promise} - * @throws {Error} + * @throws {Error} */ checkForTwoFactor(identity) { return this.fetch.get('two-fa/check', { identity }).catch((error) => { diff --git a/addon/utils/extract-latitude.js b/addon/utils/extract-latitude.js deleted file mode 100644 index 4227e43..0000000 --- a/addon/utils/extract-latitude.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable no-unused-vars */ -import Terraformer from 'terraformer'; -import { isArray } from '@ember/array'; - -export default function extractLatitude(position) { - let [longitude, latitude] = [0, 0]; - - if (!position) { - return 0; - } - - if (position instanceof Terraformer.Point || isArray(position.coordinates)) { - [longitude, latitude] = position.coordinates; - - return latitude; - } - - if (typeof position === 'object') { - let latitude = position['lat'] || position['latitude'] || position['x']; - - return latitude; - } - - return latitude; -} diff --git a/addon/utils/extract-longitude.js b/addon/utils/extract-longitude.js deleted file mode 100644 index e240c68..0000000 --- a/addon/utils/extract-longitude.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable no-unused-vars */ -import Terraformer from 'terraformer'; -import { isArray } from '@ember/array'; - -export default function extractLongitude(position) { - let latitude, longitude; - - if (!position) { - return 0; - } - - if (position instanceof Terraformer.Point || isArray(position.coordinates)) { - [longitude, latitude] = position.coordinates; - - return longitude; - } - - if (typeof position === 'object') { - let longitude = position['lng'] || position['longitude'] || position['lon'] || position['y']; - - return longitude; - } - - return longitude; -} diff --git a/app/utils/extract-latitude.js b/app/utils/extract-latitude.js deleted file mode 100644 index 9f0fda8..0000000 --- a/app/utils/extract-latitude.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@fleetbase/ember-core/utils/extract-latitude'; diff --git a/app/utils/extract-longitude.js b/app/utils/extract-longitude.js deleted file mode 100644 index 397b5a0..0000000 --- a/app/utils/extract-longitude.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@fleetbase/ember-core/utils/extract-longitude'; diff --git a/tests/unit/utils/extract-latitude-test.js b/tests/unit/utils/extract-latitude-test.js deleted file mode 100644 index 1529d50..0000000 --- a/tests/unit/utils/extract-latitude-test.js +++ /dev/null @@ -1,10 +0,0 @@ -import extractLatitude from 'dummy/utils/extract-latitude'; -import { module, test } from 'qunit'; - -module('Unit | Utility | extract-latitude', function () { - // TODO: Replace this with your real tests. - test('it works', function (assert) { - let result = extractLatitude(); - assert.ok(result); - }); -}); diff --git a/tests/unit/utils/extract-longitude-test.js b/tests/unit/utils/extract-longitude-test.js deleted file mode 100644 index 60670ed..0000000 --- a/tests/unit/utils/extract-longitude-test.js +++ /dev/null @@ -1,10 +0,0 @@ -import extractLongitude from 'dummy/utils/extract-longitude'; -import { module, test } from 'qunit'; - -module('Unit | Utility | extract-longitude', function () { - // TODO: Replace this with your real tests. - test('it works', function (assert) { - let result = extractLongitude(); - assert.ok(result); - }); -});