1 | import { normalizeRawLicense } from './normalize-raw-license.esm.js';
|
2 | import { normalizeRawRepository } from './normalize-raw-repository.esm.js';
|
3 |
|
4 | function normalizeRawPackument({
|
5 | rawPackument
|
6 | }) {
|
7 | const {
|
8 | _id: id,
|
9 | 'dist-tags': distTags,
|
10 | time,
|
11 | license: rawLicense,
|
12 | repository: rawRepository
|
13 | } = rawPackument;
|
14 | const license = normalizeRawLicense({
|
15 | rawLicense
|
16 | });
|
17 | const gitRepository = normalizeRawRepository({
|
18 | rawRepository
|
19 | });
|
20 | const versionsToTimestamps = Object.fromEntries(Object.entries(time).filter(([key]) => {
|
21 | return !['created', 'modified'].includes(key);
|
22 | }));
|
23 | return { ...rawPackument,
|
24 | id,
|
25 | distTags,
|
26 | versionsToTimestamps,
|
27 | license,
|
28 | gitRepository
|
29 | };
|
30 | }
|
31 |
|
32 | export { normalizeRawPackument };
|
33 |
|