Acme.BookStore.HttpApi.Host/node_modules/resolve-url/readme.md

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

Overview
========

[![browser support](https://ci.testling.com/lydell/resolve-url.png)](https://ci.testling.com/lydell/resolve-url)

Like Node.js’ [`path.resolve`]/[`url.resolve`] for the browser.

```js
var resolveUrl = require("resolve-url")

window.location
// https://example.com/articles/resolving-urls/edit

resolveUrl("remove")
// https://example.com/articles/resolving-urls/remove

resolveUrl("/static/scripts/app.js")
// https://example.com/static/scripts/app.js

// Imagine /static/scripts/app.js contains `//# sourceMappingURL=../source-maps/app.js.map`
resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map")
// https://example.com/static/source-maps/app.js.map

resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map", "../coffee/app.coffee")
// https://example.com/static/coffee/app.coffee

resolveUrl("//cdn.example.com/jquery.js")
// https://cdn.example.com/jquery.js

resolveUrl("http://foo.org/")
// http://foo.org/
```


Installation
============

- `npm install resolve-url`
- `bower install resolve-url`
- `component install lydell/resolve-url`

Works with CommonJS, AMD and browser globals, through UMD.


Usage
=====

### `resolveUrl(...urls)` ###

Pass one or more urls. Resolves the last one to an absolute url, using the
previous ones and `window.location`.

It’s like starting out on `window.location`, and then clicking links with the
urls as `href` attributes in order, from left to right.

Unlike Node.js’ [`path.resolve`], this function always goes through all of the
arguments, from left to right. `path.resolve` goes from right to left and only
in the worst case goes through them all. Should that matter.

Actually, the function is _really_ like clicking a lot of links in series: An
后面还有 23 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。