mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 21:25:26 +00:00
Refactored manifest creation to use Object.entries
This commit is contained in:
14
src/pass.ts
14
src/pass.ts
@@ -268,15 +268,17 @@ export class Pass {
|
|||||||
* and returning the compiled manifest
|
* and returning the compiled manifest
|
||||||
*/
|
*/
|
||||||
const archive = new ZipFile();
|
const archive = new ZipFile();
|
||||||
const manifest = Object.keys(finalBundle).reduce<Schemas.Manifest>(
|
const manifest = Object.entries(finalBundle).reduce<Schemas.Manifest>(
|
||||||
(acc, current) => {
|
(acc, [fileName, buffer]) => {
|
||||||
let hashFlow = forge.md.sha1.create();
|
let hashFlow = forge.md.sha1.create();
|
||||||
|
|
||||||
hashFlow.update(finalBundle[current].toString("binary"));
|
hashFlow.update(buffer.toString("binary"));
|
||||||
archive.addBuffer(finalBundle[current], current);
|
archive.addBuffer(buffer, fileName);
|
||||||
acc[current] = hashFlow.digest().toHex();
|
|
||||||
|
|
||||||
return acc;
|
return {
|
||||||
|
...acc,
|
||||||
|
[fileName]: hashFlow.digest().toHex(),
|
||||||
|
};
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user