/
githubmirror
/
yarn
Обзор
Документация
Войти
/
githubmirror
/
yarn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/util/path.js
18 строк
429 B
Valerii Iatsko
chore(utils): replace last `expandPath` with `resolveWithHome` (#4605)
04 окт 2017, 22:51
04 окт 2017, 22:51
3178e07
Код
Авторство
О чём код?
/* @flow */ import {resolve} from 'path'; const userHome = require('./user-home-dir').default; export function getPosixPath(path: string): string { return path.replace(/\\/g, '/'); } export function resolveWithHome(path: string): string { const homePattern = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//; if (homePattern.test(path)) { return resolve(userHome, path.substr(2)); } return resolve(path); }