samsung-device-helper 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,2 @@
1
- declare const phones: ({
2
- name: string;
3
- releaseDate: string;
4
- models: string[];
5
- } | {
6
- name: string;
7
- releaseDate: null;
8
- models: string[];
9
- } | undefined)[];
1
+ import { Device } from "../types";
2
+ export declare const phones: Device[];
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
- const phones = [
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.phones = void 0;
4
+ exports.phones = [
3
5
  {
4
6
  name: "Galaxy Z Fold6",
5
7
  releaseDate: "07-24-2024",
@@ -111,7 +113,6 @@ const phones = [
111
113
  "SM-S928E/DS",
112
114
  ],
113
115
  },
114
- ,
115
116
  {
116
117
  name: "Galaxy S24+",
117
118
  releaseDate: "01-24-2024",
@@ -127,7 +128,6 @@ const phones = [
127
128
  "SM-S926E/DS",
128
129
  ],
129
130
  },
130
- ,
131
131
  {
132
132
  name: "Galaxy S24",
133
133
  releaseDate: "01-24-2024",
@@ -187,7 +187,6 @@ const phones = [
187
187
  "SM-A156E/DSN",
188
188
  ],
189
189
  },
190
- ,
191
190
  {
192
191
  name: "Galaxy A15",
193
192
  releaseDate: "12-16-2023",
@@ -359,13 +358,11 @@ const phones = [
359
358
  "SM-A3460",
360
359
  ],
361
360
  },
362
- ,
363
361
  {
364
362
  name: "Galaxy M14",
365
363
  releaseDate: "03-08-2023",
366
364
  models: ["SM-M146B", "SM-M146B/DS", "SM-M146B/DSN"],
367
365
  },
368
- ,
369
366
  {
370
367
  name: "Galaxy S23 Ultra",
371
368
  releaseDate: "02-17-2023",
@@ -381,7 +378,6 @@ const phones = [
381
378
  "SM-S918E/DS",
382
379
  ],
383
380
  },
384
- ,
385
381
  {
386
382
  name: "Galaxy S23+",
387
383
  releaseDate: "02-17-2023",
@@ -397,7 +393,6 @@ const phones = [
397
393
  "SM-S916E/DS",
398
394
  ],
399
395
  },
400
- ,
401
396
  {
402
397
  name: "Galaxy S23",
403
398
  releaseDate: "02-17-2023",
@@ -413,7 +408,6 @@ const phones = [
413
408
  "SM-S911E/DS",
414
409
  ],
415
410
  },
416
- ,
417
411
  {
418
412
  name: "Galaxy A14",
419
413
  releaseDate: "03-27-2023",
@@ -444,7 +438,6 @@ const phones = [
444
438
  "SM-A146M",
445
439
  ],
446
440
  },
447
- ,
448
441
  {
449
442
  name: "Galaxy F04",
450
443
  releaseDate: "01-12-2023",
@@ -595,7 +588,6 @@ const phones = [
595
588
  "SM-S536DL",
596
589
  ],
597
590
  },
598
- ,
599
591
  {
600
592
  name: "Galaxy A33 5G",
601
593
  releaseDate: "04-20-2022",
@@ -669,7 +661,6 @@ const phones = [
669
661
  "SM-S908E/DS",
670
662
  ],
671
663
  },
672
- ,
673
664
  {
674
665
  name: "Galaxy S22+ 5G",
675
666
  releaseDate: "02-25-2022",
@@ -685,7 +676,6 @@ const phones = [
685
676
  "SM-S906E/DS",
686
677
  ],
687
678
  },
688
- ,
689
679
  {
690
680
  name: "Galaxy S22 5G",
691
681
  releaseDate: "02-25-2022",
@@ -701,7 +691,6 @@ const phones = [
701
691
  "SM-S901E/DS",
702
692
  ],
703
693
  },
704
- ,
705
694
  {
706
695
  name: "Galaxy Tab S8 Ultra",
707
696
  releaseDate: "04-30-2022",
@@ -734,7 +723,6 @@ const phones = [
734
723
  "SM-G990U3",
735
724
  ],
736
725
  },
737
- ,
738
726
  {
739
727
  name: "Galaxy Tab A8 10.5 (2021)",
740
728
  releaseDate: "01-17-2022",
@@ -1,55 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAllSamsungDevices = exports.getAllSamsungWatches = exports.getAllSamsungTablets = exports.getAllSamsungPhones = exports.getDeviceByModel = exports.getPhoneByModel = exports.getNameByModel = void 0;
4
+ const phones_1 = require("./data/phones");
4
5
  const getNameByModel = (model) => {
5
- if (model === "SM-G991B") {
6
- return "Galaxy S21 5G";
7
- }
8
- return model;
6
+ var _a;
7
+ return ((_a = phones_1.phones.find((phone) => { var _a; return (_a = phone === null || phone === void 0 ? void 0 : phone.models) === null || _a === void 0 ? void 0 : _a.includes(model); })) === null || _a === void 0 ? void 0 : _a.name) || model;
9
8
  };
10
9
  exports.getNameByModel = getNameByModel;
11
10
  const getPhoneByModel = (model) => {
12
- return (0, exports.getAllSamsungPhones)().find((phone) => phone.model === model);
11
+ return phones_1.phones.find((phone) => { var _a; return (_a = phone === null || phone === void 0 ? void 0 : phone.models) === null || _a === void 0 ? void 0 : _a.includes(model); });
13
12
  };
14
13
  exports.getPhoneByModel = getPhoneByModel;
15
14
  const getDeviceByModel = (model) => {
16
- return (0, exports.getAllSamsungDevices)().find((device) => device.model === model);
15
+ return phones_1.phones.find((phone) => { var _a; return (_a = phone === null || phone === void 0 ? void 0 : phone.models) === null || _a === void 0 ? void 0 : _a.includes(model); });
17
16
  };
18
17
  exports.getDeviceByModel = getDeviceByModel;
19
18
  const getAllSamsungPhones = () => {
20
- return [
21
- {
22
- model: "SM-G991B",
23
- name: "Galaxy S21 5G",
24
- releaseDate: "2021-01-29",
25
- type: "phone",
26
- },
27
- // complete full list
28
- ];
19
+ return phones_1.phones.filter((phone) => !phone.name.includes("Tab") && !phone.name.includes("Watch"));
29
20
  };
30
21
  exports.getAllSamsungPhones = getAllSamsungPhones;
31
22
  const getAllSamsungTablets = () => {
32
- return [
33
- {
34
- model: "SM-T970",
35
- name: "Galaxy Tab S7",
36
- releaseDate: "2020-08-05",
37
- type: "tablet",
38
- },
39
- // complete full list
40
- ];
23
+ return phones_1.phones.filter((phone) => phone.name.includes("Tab"));
41
24
  };
42
25
  exports.getAllSamsungTablets = getAllSamsungTablets;
43
26
  const getAllSamsungWatches = () => {
44
- return [
45
- {
46
- model: "SM-R800",
47
- name: "Galaxy Watch",
48
- releaseDate: "2018-08-24",
49
- type: "watch",
50
- },
51
- // complete full list
52
- ];
27
+ return phones_1.phones.filter((phone) => phone.name.includes("Watch"));
53
28
  };
54
29
  exports.getAllSamsungWatches = getAllSamsungWatches;
55
30
  const getAllSamsungDevices = () => {
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type DeviceType = "phone" | "tablet" | "watch";
2
2
  export type Device = {
3
- model: string;
4
3
  name: string;
5
- releaseDate: string;
6
- type: DeviceType;
4
+ releaseDate: string | null;
5
+ models: string[];
6
+ type?: DeviceType;
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samsung-device-helper",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A utility to help you identify Samsung devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,8 @@
13
13
  "pretest": "tsc -p tests",
14
14
  "test": "mocha",
15
15
  "prepack": "yarn run build",
16
- "pack": "npm pack"
16
+ "pack": "npm pack",
17
+ "publish": "npm version patch && yarn prepack && yarn pack && npm publish"
17
18
  },
18
19
  "repository": {
19
20
  "type": "git",