@aikdna/kdna-cli 0.21.0 → 0.22.0

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/src/verify.js CHANGED
@@ -62,7 +62,11 @@ function validateManifestFn(manifest) {
62
62
  if (manifest.format && manifest.format !== 'kdna') {
63
63
  errors.push(`kdna.json.format: invalid value "${manifest.format}". Expected "kdna".`);
64
64
  }
65
- if (manifest.format_version && manifest.format_version !== '1.0' && manifest.format_version !== '2.0') {
65
+ if (
66
+ manifest.format_version &&
67
+ manifest.format_version !== '1.0' &&
68
+ manifest.format_version !== '2.0'
69
+ ) {
66
70
  errors.push(
67
71
  `kdna.json.format_version: invalid value "${manifest.format_version}". Expected "1.0" or "2.0".`,
68
72
  );
@@ -118,8 +122,11 @@ function assetView(kdnaPath, options = {}) {
118
122
  allEntries.add('KDNA_Core.json');
119
123
  allEntries.add('KDNA_Patterns.json');
120
124
  return {
121
- kind: 'asset', path: kdnaPath,
122
- exists(name) { return allEntries.has(name) || entries.has(name); },
125
+ kind: 'asset',
126
+ path: kdnaPath,
127
+ exists(name) {
128
+ return allEntries.has(name) || entries.has(name);
129
+ },
123
130
  readJson(name) {
124
131
  if (entries.has(name)) return readContainerJson(kdnaPath, name, options);
125
132
  return _ensureDataMap()[name] || null;
@@ -130,7 +137,14 @@ function assetView(kdnaPath, options = {}) {
130
137
  return dm[name] ? JSON.stringify(dm[name]) : '';
131
138
  },
132
139
  listDirFiles(dirName) {
133
- return [...entries].filter(e => e.startsWith(dirName.replace(//+$/,'')+'/')).map(e => { const r = e.slice(dirName.length+1); return r.includes('/') ? null : r; }).filter(Boolean);
140
+ const prefix = dirName.replace(/\/+$/, '') + '/';
141
+ return [...entries]
142
+ .filter((e) => e.startsWith(prefix))
143
+ .map((e) => {
144
+ const r = e.slice(prefix.length);
145
+ return r.includes('/') ? null : r;
146
+ })
147
+ .filter(Boolean);
134
148
  },
135
149
  };
136
150
  }