UNPKG

@autorest/powershell

Version:
25 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PsdFile = void 0; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ const codegen_1 = require("@azure-tools/codegen"); class PsdFile extends codegen_1.TextWithRegions { constructor(content, objectIntializer) { content = content || '@{}'; // https://stackoverflow.com/a/10805292/294804 // eslint-disable-next-line no-sparse-arrays const [, header, contents, footer] = /(^.*?@{)(.*)(}\s*)/.exec(new codegen_1.Text(content).text.replace(/\r?\n|\r/g, '«').replace(/^«*/, '').replace(/«*$/, '')) || [, '@{', '', '}']; super((contents || '').replace(/«/g, '\n')); this.header = header || ''; this.footer = footer || ''; this.apply(objectIntializer); } get text() { return [this.header, super.text, this.footer].join(codegen_1.EOL); } } exports.PsdFile = PsdFile; //# sourceMappingURL=psd-file.js.map