Change type of revision to a number

This commit is contained in:
Rowan Cockett
2021-10-08 15:52:12 -06:00
parent abbd620220
commit 47099d0468
4 changed files with 5 additions and 5 deletions

View File

@ -12,7 +12,7 @@ describe("Packer", () => {
beforeEach(() => { beforeEach(() => {
file = new File({ file = new File({
creator: "Dolan Miu", creator: "Dolan Miu",
revision: "1", revision: 1,
lastModifiedBy: "Dolan Miu", lastModifiedBy: "Dolan Miu",
sections: [ sections: [
{ {

View File

@ -38,7 +38,7 @@ describe("Properties", () => {
keywords: "test docx", keywords: "test docx",
description: "testing document", description: "testing document",
lastModifiedBy: "the author", lastModifiedBy: "the author",
revision: "123", revision: 123,
}); });
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]); expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]);

View File

@ -17,7 +17,7 @@ export interface IPropertiesOptions {
readonly keywords?: string; readonly keywords?: string;
readonly description?: string; readonly description?: string;
readonly lastModifiedBy?: string; readonly lastModifiedBy?: string;
readonly revision?: string; readonly revision?: number;
readonly externalStyles?: string; readonly externalStyles?: string;
readonly styles?: IStylesOptions; readonly styles?: IStylesOptions;
readonly numbering?: INumberingOptions; readonly numbering?: INumberingOptions;
@ -89,7 +89,7 @@ export class CoreProperties extends XmlComponent {
this.root.push(new StringContainer("cp:lastModifiedBy", options.lastModifiedBy)); this.root.push(new StringContainer("cp:lastModifiedBy", options.lastModifiedBy));
} }
if (options.revision) { if (options.revision) {
this.root.push(new StringContainer("cp:revision", options.revision)); this.root.push(new StringContainer("cp:revision", String(options.revision)));
} }
this.root.push(new TimestampElement("dcterms:created")); this.root.push(new TimestampElement("dcterms:created"));
this.root.push(new TimestampElement("dcterms:modified")); this.root.push(new TimestampElement("dcterms:modified"));

View File

@ -57,7 +57,7 @@ export class File {
this.coreProperties = new CoreProperties({ this.coreProperties = new CoreProperties({
...options, ...options,
creator: options.creator ?? "Un-named", creator: options.creator ?? "Un-named",
revision: options.revision ?? "1", revision: options.revision ?? 1,
lastModifiedBy: options.lastModifiedBy ?? "Un-named", lastModifiedBy: options.lastModifiedBy ?? "Un-named",
}); });