mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 20:25:26 +00:00
Moved splitBundle to utils and set optional to additionalBuffers
This commit is contained in:
16
src/utils.ts
16
src/utils.ts
@@ -1,5 +1,6 @@
|
||||
import moment from "moment";
|
||||
import { EOL } from "os";
|
||||
import { BundleUnit } from "./schema";
|
||||
|
||||
/**
|
||||
* Checks if an rgb value is compliant with CSS-like syntax
|
||||
@@ -80,3 +81,18 @@ export function generateStringFile(lang: { [index: string]: string }): Buffer {
|
||||
|
||||
return Buffer.from(strings.join(EOL), "utf8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a partition to split one bundle
|
||||
* to two
|
||||
* @param origin
|
||||
*/
|
||||
|
||||
export function splitBundle(origin: Object): [BundleUnit, BundleUnit] {
|
||||
const keys = Object.keys(origin);
|
||||
return keys.reduce(([ l10n, bundle ], current) =>
|
||||
current.includes(".lproj") &&
|
||||
[ { ...l10n, [current]: origin[current] }, bundle] ||
|
||||
[ l10n, {...bundle, [current]: origin[current] }]
|
||||
, [{},{}]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user