Skip to content

Commit c847bce

Browse files
committed
feat: export utils
1 parent 2060593 commit c847bce

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"unpkg": "./dist/index.umd.js",
2222
"scripts": {
2323
"build": "rm -rf dist && microbundle src/index.ts",
24-
"test": "npm run build -f modern && vitest --run",
24+
"test": "vitest --run",
2525
"prepublishOnly": "npm run build",
2626
"lint": "prettier --write .",
2727
"type-check": "tsc",

graph.spec-d.ts renamed to src/Graph.spec-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expectTypeOf, it } from 'vitest';
2-
import { Graph } from './src/index.js';
2+
import { Graph } from './index.js';
33

44
/**
55
* Those tests are not run. Their sole purpose is to test the types.

graph.spec.ts renamed to src/Graph.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { describe, expect, it } from 'vitest';
22

3-
import { depthFirstSearch, Graph } from './src/index.js';
4-
import { indegree } from './src/utils/indegree.js';
5-
import { outdegree } from './src/utils/outdegree.js';
3+
import { depthFirstSearch, Graph } from './index.js';
4+
import { indegree } from './utils/indegree.js';
5+
import { outdegree } from './utils/outdegree.js';
66

77
describe('Graph', function () {
88
describe('Data structure', function () {

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
export type { Edge, Serialized, SerializedInput, EdgeWeight } from './types.js';
2+
23
export { Graph } from './Graph.js';
34
export { CycleError } from './CycleError.js';
45

6+
// Algorithms
57
export { depthFirstSearch } from './algorithms/depthFirstSearch/index.js';
68
export { shortestPath, shortestPaths } from './algorithms/shortestPath/index.js';
79
export { topologicalSort } from './algorithms/topologicalSort/index.js';
810
export { lowestCommonAncestors } from './algorithms/lowestCommonAncestors/index.js';
11+
12+
// Utils
13+
export { indegree } from './utils/indegree.js';
14+
export { outdegree } from './utils/outdegree.js';
15+
export { cloneGraph } from './utils/cloneGraph.js';
16+
export { hasCycle } from './utils/hasCycle.js';
17+
export { serializeGraph } from './utils/serializeGraph.js';
18+
export { deserializeGraph } from './utils/deserializeGraph.js';

0 commit comments

Comments
 (0)