@pixwel/pixwel-sdk 1.1.11 → 2.1.0

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.
Files changed (47) hide show
  1. package/.babelrc +2 -1
  2. package/README.md +60 -0
  3. package/coverage/clover.xml +375 -226
  4. package/coverage/coverage-final.json +11 -5
  5. package/coverage/lcov-report/Ass.js.html +1 -1
  6. package/coverage/lcov-report/Asset.js.html +4 -4
  7. package/coverage/lcov-report/AssetType.js.html +98 -0
  8. package/coverage/lcov-report/Encode.js.html +98 -0
  9. package/coverage/lcov-report/File.js.html +98 -0
  10. package/coverage/lcov-report/Filename.js.html +11 -719
  11. package/coverage/lcov-report/Ingest.js.html +1240 -280
  12. package/coverage/lcov-report/IngestFile.js.html +5 -5
  13. package/coverage/lcov-report/Model.js.html +821 -0
  14. package/coverage/lcov-report/Order.js.html +25 -25
  15. package/coverage/lcov-report/Srt.js.html +1 -1
  16. package/coverage/lcov-report/Sub.js.html +1 -1
  17. package/coverage/lcov-report/Tag.js.html +98 -0
  18. package/coverage/lcov-report/TimeFormat.js.html +1 -1
  19. package/coverage/lcov-report/fileType.js.html +188 -0
  20. package/coverage/lcov-report/index.html +114 -36
  21. package/coverage/lcov.info +787 -474
  22. package/dist/index.js +74 -22
  23. package/dist/src/Asset.js +10 -5
  24. package/dist/src/AssetType.js +54 -0
  25. package/dist/src/Encode.js +54 -0
  26. package/dist/src/File.js +54 -0
  27. package/dist/src/Filename.js +7 -222
  28. package/dist/src/Ingest.js +370 -35
  29. package/dist/src/IngestFile.js +6 -2
  30. package/dist/src/Model.js +569 -0
  31. package/dist/src/Order.js +20 -9
  32. package/dist/src/Srt.js +5 -1
  33. package/dist/src/Tag.js +54 -0
  34. package/dist/src/fileType.js +43 -0
  35. package/index.js +14 -0
  36. package/package.json +9 -3
  37. package/src/AssetType.js +11 -0
  38. package/src/Encode.js +11 -0
  39. package/src/File.js +11 -0
  40. package/src/Filename.js +0 -236
  41. package/src/Ingest.js +350 -30
  42. package/src/Model.js +252 -0
  43. package/src/Tag.js +11 -0
  44. package/src/fileType.js +41 -0
  45. package/test/Filename.spec.js +9 -685
  46. package/test/Ingest.spec.js +1107 -152
  47. package/test/Model.spec.js +328 -0
@@ -0,0 +1,41 @@
1
+ const extname = require("path").extname;
2
+
3
+ const TYPES = {
4
+ document: ["doc", "docx", "xls", "xlsx", "txt", "pdf", "ppt", "pptx"],
5
+
6
+ video: ["mov", "mp4", "m4v", "mpg", "mxf"],
7
+
8
+ audio: ["mp3", "wav", "m4a"],
9
+
10
+ image: ["jpg", "jpeg", "png", "tif", "tiff", "ai", "psd", "eps"],
11
+
12
+ zip: ["zip"]
13
+ };
14
+
15
+ function extensionType(extension) {
16
+ for (var type in TYPES) {
17
+ if (TYPES[type].indexOf(extension) > -1) {
18
+ return type;
19
+ }
20
+ }
21
+ }
22
+
23
+ function extension(path) {
24
+ return extname(path.split("?")[0].toLowerCase()).substring(1);
25
+ }
26
+
27
+ function mediaType(path) {
28
+ var type = extensionType(extension(path));
29
+
30
+ if (type) {
31
+ return type;
32
+ }
33
+
34
+ throw new Error(`Unknown extension '${extension}'`);
35
+ }
36
+
37
+ module.exports = {
38
+ extension,
39
+ extensionType,
40
+ mediaType
41
+ };