@acce/lit-path 中文文档教程
Lit Paths
这是一个尽可能干净地将 node.js 路径 API 实现到浏览器中的简单项目。
install
npm i -S @acce/lit-path
use
import * as path from '@acce/lit-path';
path.dirname('/test/directory.ext'); //> "/test"
或者
import { basename } from '@acce/lit-path';
path.basename('/test/directory.ext', '.ext'); //> "directory"
Supported APIs
这使用 node.js 路径 API 实现了接近 1-1 的代码。
以下是已实现的 API
- path.basename
- path.dirname
- path.extname
- path.normalize
- path.join
- path.resolve
- path.parse
- path.format
differences
process.cwd()
is assumed to be thelocation.pathname
- path format is always posix, because the web…
Lit Paths
This is a simple project to implement node.js path API into a browser, as cleanly as possible.
install
npm i -S @acce/lit-path
use
import * as path from '@acce/lit-path';
path.dirname('/test/directory.ext'); //> "/test"
or
import { basename } from '@acce/lit-path';
path.basename('/test/directory.ext', '.ext'); //> "directory"
Supported APIs
This implements near 1-1 code with node.js path API.
Here are the implemented APIs
- path.basename
- path.dirname
- path.extname
- path.normalize
- path.join
- path.resolve
- path.parse
- path.format
differences
process.cwd()
is assumed to be thelocation.pathname
- path format is always posix, because the web…