@bgord/tools 1.1.15 → 1.1.16

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.
package/dist/mime.vo.js CHANGED
@@ -10,12 +10,11 @@ export class Mime {
10
10
  this.subtype = subtype;
11
11
  }
12
12
  static fromString(candidate) {
13
- const { type, subtype } = MimeValue.parse(candidate);
13
+ const { type, subtype } = MimeValue.parse(candidate.split(";")[0].trim());
14
14
  return new Mime(type, subtype);
15
15
  }
16
16
  static fromExtension(extension) {
17
- const { type, subtype } = MimeValue.parse(String(mime.contentType(extension)));
18
- return new Mime(type, subtype);
17
+ return Mime.fromString(String(mime.contentType(extension)));
19
18
  }
20
19
  isSatisfiedBy(another) {
21
20
  if (!(this.type === another.type || this.type === "*"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/tools",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Bartosz Gordon",
package/src/mime.vo.ts CHANGED
@@ -11,15 +11,13 @@ export class Mime {
11
11
  ) {}
12
12
 
13
13
  static fromString(candidate: string): Mime {
14
- const { type, subtype } = MimeValue.parse(candidate);
14
+ const { type, subtype } = MimeValue.parse(candidate.split(";")[0].trim());
15
15
 
16
16
  return new Mime(type, subtype);
17
17
  }
18
18
 
19
19
  static fromExtension(extension: ExtensionType): Mime {
20
- const { type, subtype } = MimeValue.parse(String(mime.contentType(extension)));
21
-
22
- return new Mime(type, subtype);
20
+ return Mime.fromString(String(mime.contentType(extension)));
23
21
  }
24
22
 
25
23
  isSatisfiedBy(another: Mime): boolean {