1 | "use strict";
|
2 |
|
3 | const uuidv5 = require(`uuid/v5`);
|
4 |
|
5 | const report = require(`gatsby-cli/lib/reporter`);
|
6 |
|
7 | const seedConstant = `638f7a53-c567-4eca-8fc1-b23efb1cfb2b`;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function createNodeId(id, namespace) {
|
18 | if (typeof id === `number`) {
|
19 | id = id.toString();
|
20 | } else if (typeof id !== `string`) {
|
21 | report.panic(`Parameter passed to createNodeId must be a String or Number (got ${typeof id})`);
|
22 | }
|
23 |
|
24 | return uuidv5(id, uuidv5(namespace, seedConstant));
|
25 | }
|
26 |
|
27 | module.exports = createNodeId;
|
28 |
|
\ | No newline at end of file |