本文整理匯總了TypeScript中untildify.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getKnownSearchPathsForVirtualEnvs
export function getKnownSearchPathsForVirtualEnvs(): string[] {
const paths: string[] = [];
if (!IS_WINDOWS) {
const defaultPaths = ['/Envs', '/.virtualenvs', '/.pyenv', '/.pyenv/versions'];
defaultPaths.forEach(p => {
paths.push(untildify('~' + p));
});
}
const venvPath = settings.PythonSettings.getInstance().venvPath;
if (venvPath) {
paths.push(untildify(venvPath));
}
if (workspace.rootPath) {
paths.push(workspace.rootPath);
}
return paths;
}
示例2: findConfig
function findConfig(domain: ConfigDomain, exists: boolean = true) {
const configPath = untildify(configPaths[domain]);
const absolute = path.isAbsolute(configPath);
let currentDir = process.cwd();
let fullPath = absolute ? configPath : path.resolve(currentDir, configPath);
if (!exists) {
return fullPath;
}
// If the config path is not already an absolute path, recursively
// find the config file until we find an existing one.
while (!absolute && currentDir !== path.dirname(currentDir)) {
fullPath = path.resolve(currentDir, configPath);
if (fs.existsSync(fullPath)) {
if (domain === ConfigDomain.LocalDomain && isGlobalConfigPath(fullPath)) {
// We are looking for local config, but we only find the global
// one, meaning local config doesn't exist.
return undefined;
}
return fullPath;
}
currentDir = path.dirname(currentDir);
}
fullPath = path.resolve(currentDir, configPath);
return fs.existsSync(fullPath) ? fullPath : undefined;
}
示例3: _generate
function _generate(name: string, location: string) {
Logger.info('Creating project directory...');
let sanitizedName = _sanitize(name);
let folder: string = Untildify(Path.join(location, sanitizedName));
_mkdir(folder);
Logger.info('Creating database directory...');
let dbFolder = Path.join(folder, 'db');
_mkdir(dbFolder);
Logger.info('Creating environment.json...');
let environment = environmentGenerator();
let environmentPath = Path.join(folder, 'environment.json');
_writeJSON(environmentPath, environment);
Logger.info('Creating resources.json...');
let resources = _resourcesGenerator(name);
let resourcePath = Path.join(folder, 'resources.json');
_writeJSON(resourcePath, resources);
}
示例4: isGlobalConfigPath
function isGlobalConfigPath(configPath: string) {
const globalConfigPath = path.resolve(
untildify(configPaths[ConfigDomain.GlobalDomain])
);
return globalConfigPath === configPath;
}