@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.
@@ -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(filename: string): Promise<string | null>;
11
- export declare function isPointInGeoJSON(latLng: number[], fileName: string): Promise<any>;
10
+ export declare function loadAsset(filePath: string): Promise<string | null>;
11
+ export declare function isPointInGeoJSON(latLng: number[], filePath: string): Promise<any>;
12
12
  export {};
@@ -71,10 +71,10 @@ function getValueFromSettings(settings, key, envVar, defaultValue) {
71
71
  }
72
72
  return process.env[envVar] || defaultValue;
73
73
  }
74
- function loadAsset(filename) {
74
+ function loadAsset(filePath) {
75
75
  return __awaiter(this, void 0, void 0, function* () {
76
76
  try {
77
- const file = path.join(__dirname, '..', 'geojson', `${filename}.json`);
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, fileName) {
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(fileName);
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",