@utiliread/primitives 1.0.0-127 → 1.0.0-128

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utiliread/primitives",
3
- "version": "1.0.0-127",
3
+ "version": "1.0.0-128",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -2,12 +2,13 @@ import { Repository } from "./repository";
2
2
  import { expect } from "chai";
3
3
 
4
4
  describe("ctor", () => {
5
- it("creates", () => {
5
+ it.only("creates", () => {
6
6
  expect(Repository("gpkv", "gjoel")).to.equal("gpkv/gjoel");
7
7
  expect(Repository("gpkv/gjoel")).to.equal("gpkv/gjoel");
8
8
  });
9
- it("throws if wrong format", () => {
9
+ it.only("throws if wrong format", () => {
10
10
  expect(() => Repository("invalid")).to.throw();
11
+ expect(() => Repository("[object%20Object]", "dashboard")).to.throw();
11
12
  });
12
13
  });
13
14
 
package/src/repository.ts CHANGED
@@ -11,12 +11,9 @@ export function Repository(repoOrTeam: string, name?: string): Repository {
11
11
  return repo;
12
12
  }
13
13
 
14
- const PART_REGEX = new RegExp(/[a-z][a-z0-9-]*/);
15
-
16
14
  export namespace Repository {
17
15
  export function isRepository(input: string): input is Repository {
18
- const parts = input.split("/");
19
- return parts.length === 2 && !parts.some((x) => !PART_REGEX.test(x));
16
+ return /^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(input);
20
17
  }
21
18
 
22
19
  export function split(repo: Repository) {