mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 20:48:29 +02:00
feat: add @actions/cache
This commit is contained in:
parent
b15fb7d098
commit
16e8c96a41
1932 changed files with 261172 additions and 10 deletions
35
node_modules/@azure/ms-rest-js/lib/util/xml.ts
generated
vendored
Normal file
35
node_modules/@azure/ms-rest-js/lib/util/xml.ts
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
import * as xml2js from "xml2js";
|
||||
|
||||
export function stringifyXML(obj: any, opts?: { rootName?: string }) {
|
||||
const builder = new xml2js.Builder({
|
||||
rootName: (opts || {}).rootName,
|
||||
renderOpts: {
|
||||
pretty: false,
|
||||
},
|
||||
});
|
||||
return builder.buildObject(obj);
|
||||
}
|
||||
|
||||
export function parseXML(str: string): Promise<any> {
|
||||
const xmlParser = new xml2js.Parser({
|
||||
explicitArray: false,
|
||||
explicitCharkey: false,
|
||||
explicitRoot: false,
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!str) {
|
||||
reject(new Error("Document is empty"));
|
||||
} else {
|
||||
xmlParser.parseString(str, (err?: Error, res?: any) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue