Comparing version 0.6.0 to 0.7.0
@@ -0,1 +1,7 @@ | ||
type JSONObject = {[key: string]: JSONValue}; | ||
interface JSONArray extends Array<JSONValue> {} | ||
export type JSONValue = string | number | boolean | null | JSONObject | JSONArray; | ||
export type JSONStringifyable = string | number | boolean | null | object; | ||
export type BeforeRequestHook = (options: Options) => void; | ||
@@ -32,3 +38,3 @@ | ||
*/ | ||
json?: object; | ||
json?: JSONStringifyable; | ||
@@ -81,3 +87,3 @@ /** | ||
formData(): Promise<FormData>; | ||
json(): Promise<unknown>; | ||
json(): Promise<JSONValue>; | ||
text(): Promise<string>; | ||
@@ -84,0 +90,0 @@ } |
@@ -141,2 +141,3 @@ /*! MIT License © Sindre Sorhus */ | ||
} | ||
if (this._options.prefixUrl && !this._options.prefixUrl.endsWith('/')) { | ||
@@ -157,2 +158,3 @@ this._options.prefixUrl += '/'; | ||
} | ||
this._input = url.toString(); | ||
@@ -159,0 +161,0 @@ } |
{ | ||
"name": "ky", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Tiny and elegant HTTP client based on the browser Fetch API", | ||
@@ -16,2 +16,4 @@ "license": "MIT", | ||
"scripts": { | ||
"build": "rollup index.js --format=umd --name=ky --file=umd.js", | ||
"prepublishOnly": "npm run build", | ||
"test": "xo && nyc ava && tsd-check && npm run cypress:run", | ||
@@ -23,3 +25,4 @@ "cypress:open": "cypress open", | ||
"index.js", | ||
"index.d.ts" | ||
"index.d.ts", | ||
"umd.js" | ||
], | ||
@@ -50,3 +53,3 @@ "keywords": [ | ||
"@types/jquery": "^3.3.29", | ||
"ava": "^1.0.1", | ||
"ava": "^1.1.0", | ||
"body": "^5.1.0", | ||
@@ -60,4 +63,5 @@ "codecov": "^3.1.0", | ||
"nyc": "^13.1.0", | ||
"rollup": "^1.1.0", | ||
"tsd-check": "^0.3.0", | ||
"xo": "^0.23.0" | ||
"xo": "^0.24.0" | ||
}, | ||
@@ -64,0 +68,0 @@ "xo": { |
@@ -6,5 +6,7 @@ <div align="center"> | ||
</div> | ||
<p align="center">Huge thanks to <a href="https://lunanode.com"><img src="https://sindresorhus.com/assets/thanks/lunanode-logo.svg" width="170"></a> for sponsoring me!</p> | ||
<br> | ||
<br> | ||
<br> | ||
<br> | ||
</div> | ||
@@ -95,3 +97,10 @@ | ||
In environments that do not support `import`, you can load `ky` in [UMD format](https://medium.freecodecamp.org/anatomy-of-js-module-systems-and-building-libraries-fadcd8dbd0e). For example, using `require()`: | ||
```js | ||
const ky = require('ky/umd').default; | ||
``` | ||
With the UMD version, it's also easy to use `ky` [without a bundler](#how-do-i-use-this-without-a-bundler-like-webpack) or module system. | ||
## API | ||
@@ -331,3 +340,18 @@ | ||
Alternatively, you can use the [`umd.js`](umd.js) file with a traditional `<script>` tag (without `type="module"`), in which case `ky` will be a global. | ||
```html | ||
<!-- Replace the version number with the latest version --> | ||
<script src="https://cdn.jsdelivr.net/npm/ky@0.5.2/umd.js"> | ||
<script> | ||
(async () => { | ||
const ky = ky.default; | ||
const json = await ky('https://jsonplaceholder.typicode.com/todos/1').json(); | ||
console.log(json.title); | ||
//=> 'delectus aut autem | ||
})(); | ||
</script> | ||
``` | ||
## Browser support | ||
@@ -334,0 +358,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32408
6
620
374
13
2