@hastehaul/common 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/build/utils/utils.d.ts +2 -2
- package/build/utils/utils.js +4 -4
- package/package.json +1 -1
package/build/utils/utils.d.ts
CHANGED
@@ -7,6 +7,6 @@ export declare function colorize(text: string, colorCode: number): string;
|
|
7
7
|
export declare function formatDatetimeToHumanReadable(datetime: Date, format?: string): string;
|
8
8
|
export declare function generateIdentifier(messageContent: string): string;
|
9
9
|
export declare function getValueFromSettings(settings: Setting[], key: string, envVar?: string, defaultValue?: any): any;
|
10
|
-
export declare function loadAsset(
|
11
|
-
export declare function isPointInGeoJSON(latLng: number[],
|
10
|
+
export declare function loadAsset(filePath: string): Promise<string | null>;
|
11
|
+
export declare function isPointInGeoJSON(latLng: number[], filePath: string): Promise<any>;
|
12
12
|
export {};
|
package/build/utils/utils.js
CHANGED
@@ -71,10 +71,10 @@ function getValueFromSettings(settings, key, envVar, defaultValue) {
|
|
71
71
|
}
|
72
72
|
return process.env[envVar] || defaultValue;
|
73
73
|
}
|
74
|
-
function loadAsset(
|
74
|
+
function loadAsset(filePath) {
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
76
76
|
try {
|
77
|
-
const file = path.join(__dirname,
|
77
|
+
const file = path.join(__dirname, `${filePath}`);
|
78
78
|
const fileContent = yield fs_1.promises.readFile(file, 'utf-8');
|
79
79
|
return fileContent;
|
80
80
|
}
|
@@ -84,12 +84,12 @@ function loadAsset(filename) {
|
|
84
84
|
}
|
85
85
|
});
|
86
86
|
}
|
87
|
-
function isPointInGeoJSON(latLng,
|
87
|
+
function isPointInGeoJSON(latLng, filePath) {
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
89
89
|
try {
|
90
90
|
if (latLng.length === 0)
|
91
91
|
return false;
|
92
|
-
const geoJsonData = yield loadAsset(
|
92
|
+
const geoJsonData = yield loadAsset(filePath);
|
93
93
|
const geojson = JSON.parse(geoJsonData);
|
94
94
|
const point = helpers_1.default.point([latLng[1], latLng[0]]);
|
95
95
|
const isInside = geojson.features.some((feature) => {
|