本文整理匯總了TypeScript中findup-sync.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: findConfiguration
export function findConfiguration(configFile: string): any {
if (configFile) {
return JSON.parse(fs.readFileSync(configFile, "utf8"));
}
// First look for package.json
configFile = findup("package.json", { nocase: true });
if (configFile) {
var content = require(configFile);
if (content.tslintConfig) {
return content.tslintConfig;
}
}
// Next look for tslint.json
var homeDir = getHomeDir();
if (!homeDir) {
return undefined;
}
var defaultPath = path.join(homeDir, CONFIG_FILENAME);
configFile = findup(CONFIG_FILENAME, { nocase: true }) || defaultPath;
return configFile ? JSON.parse(fs.readFileSync(configFile, "utf8")) : undefined;
}
示例2: findConfiguration
export function findConfiguration(configFile: string): any {
if (configFile) {
return JSON.parse(fs.readFileSync(configFile, "utf8"));
}
// First look for package.json
configFile = findup("package.json", { nocase: true });
if (configFile) {
var content = require(configFile);
if (content.tslintConfig) {
return content.tslintConfig;
}
}
// Next look for tslint.json
var environment = global.process.env;
var defaultPath = path.join((environment.HOME || environment.HOMEPATH || environment.USERPROFILE),
CONFIG_FILENAME);
configFile = findup(CONFIG_FILENAME, { nocase: true });
if (!configFile && fs.existsSync(defaultPath)) {
configFile = defaultPath;
}
return configFile ? JSON.parse(fs.readFileSync(configFile, "utf8")) : undefined;
}
示例3: findConfiguration
export function findConfiguration(configFile: string, inputFileLocation: string): any {
if (configFile) {
return JSON.parse(fs.readFileSync(configFile, "utf8"));
}
// first look for package.json from input file location
configFile = findup("package.json", { cwd: inputFileLocation, nocase: true });
if (configFile) {
const content = require(configFile);
if (content.tslintConfig) {
return content.tslintConfig;
}
}
// next look for tslint.json
const homeDir = getHomeDir();
if (!homeDir) {
return undefined;
}
const defaultPath = path.join(homeDir, CONFIG_FILENAME);
configFile = findup(CONFIG_FILENAME, { cwd: inputFileLocation, nocase: true }) || defaultPath;
if (fs.existsSync(configFile)) {
return JSON.parse(fs.readFileSync(configFile, "utf8"));
} else {
return DEFAULT_CONFIG;
}
}