UNPKG

1.27 kBJavaScriptView Raw
1var __importDefault = (this && this.__importDefault) || function (mod) {
2 return (mod && mod.__esModule) ? mod : { "default": mod };
3};
4(function (factory) {
5 if (typeof module === "object" && typeof module.exports === "object") {
6 var v = factory(require, exports);
7 if (v !== undefined) module.exports = v;
8 }
9 else if (typeof define === "function" && define.amd) {
10 define(["require", "exports", "fs", "plist"], factory);
11 }
12})(function (require, exports) {
13 "use strict";
14 Object.defineProperty(exports, "__esModule", { value: true });
15 exports.writeFile = void 0;
16 var fs_1 = __importDefault(require("fs"));
17 var plist_1 = __importDefault(require("plist"));
18 function writeFile(aFile, anObject, options, callback) {
19 if (typeof options === "function" && callback === undefined) {
20 fs_1.default.writeFile(aFile, plist_1.default.build(anObject), options);
21 }
22 else if (typeof options === "object" && typeof callback === "function") {
23 fs_1.default.writeFile(aFile, plist_1.default.build(anObject), options, callback);
24 }
25 else {
26 throw new Error("Invalid parameters passed to writeFile");
27 }
28 }
29 exports.writeFile = writeFile;
30});