UNPKG

1.13 kBJavaScriptView Raw
1"use strict";
2/**
3 * © 2013 Liferay, Inc. <https://liferay.com> and Node GH contributors
4 * (see file: README.md)
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7Object.defineProperty(exports, "__esModule", { value: true });
8const configs = require("./configs");
9const fp_1 = require("./fp");
10// -- Config -------------------------------------------------------------------
11function clone(o) {
12 return JSON.parse(JSON.stringify(o));
13}
14exports.clone = clone;
15// -- Utils --------------------------------------------------------------------
16/**
17 * Returns files in a folder path that match a given patter
18 */
19function find(dirPath, optPattern = /.*/) {
20 return fp_1.safeReaddir(dirPath).map(dirs => {
21 return dirs.filter(file => {
22 return optPattern.test(file);
23 });
24 });
25}
26exports.find = find;
27function getUser() {
28 return configs.getConfig().github_user || process.env.GH_USER;
29}
30exports.getUser = getUser;
31// Export some config methods to allow plugins to access them
32exports.getConfig = configs.getConfig;
33exports.writeGlobalConfig = configs.writeGlobalConfig;
34//# sourceMappingURL=base.js.map
\No newline at end of file