filenamify-url
Advanced tools
Comparing version 2.1.2 to 3.0.0
@@ -1,33 +0,22 @@ | ||
import {Options as FilenamifyOptions} from 'filenamify'; | ||
import {Options} from 'filenamify'; | ||
declare namespace filenamifyUrl { | ||
type Options = FilenamifyOptions; | ||
} | ||
/** | ||
Convert a URL to a valid filename. | ||
declare const filenamifyUrl: { | ||
/** | ||
Convert a URL to a valid filename. | ||
@param url - A URL to convert to a valid filename. | ||
@returns A valid filename for `url`. | ||
@param url - A URL to convert to a valid filename. | ||
@returns A valid filename for `url`. | ||
@example | ||
``` | ||
import filenamifyUrl from 'filenamify-url'; | ||
@example | ||
``` | ||
import filenamifyUrl = require('filenamify-url'); | ||
filenamifyUrl('http://sindresorhus.com/foo?bar=baz'); | ||
//=> 'sindresorhus.com!foo!bar=baz' | ||
filenamifyUrl('http://sindresorhus.com/foo?bar=baz'); | ||
//=> 'sindresorhus.com!foo!bar=baz' | ||
filenamifyUrl('http://sindresorhus.com/foo', {replacement: '🐴'}); | ||
//=> 'sindresorhus.com🐴foo' | ||
``` | ||
*/ | ||
export default function filenamifyUrl(url: string, options?: Options): string; | ||
filenamifyUrl('http://sindresorhus.com/foo', {replacement: '🐴'}); | ||
//=> 'sindresorhus.com🐴foo' | ||
``` | ||
*/ | ||
(url: string, options?: filenamifyUrl.Options): string; | ||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function filenamifyUrl(url: string, options?: Options): string; | ||
// export = filenamifyUrl; | ||
default: typeof filenamifyUrl; | ||
}; | ||
export = filenamifyUrl; | ||
export {Options} from 'filenamify'; |
13
index.js
@@ -1,6 +0,5 @@ | ||
'use strict'; | ||
const filenamify = require('filenamify'); | ||
const humanizeUrl = require('humanize-url'); | ||
import filenamify from 'filenamify'; | ||
import humanizeUrl from 'humanize-url'; | ||
const filenamifyUrl = (string, options) => { | ||
export default function filenamifyUrl(string, options) { | ||
if (typeof string !== 'string') { | ||
@@ -11,6 +10,2 @@ throw new TypeError('Expected a string'); | ||
return filenamify(decodeURIComponent(humanizeUrl(string)), options); | ||
}; | ||
module.exports = filenamifyUrl; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = filenamifyUrl; | ||
} |
{ | ||
"name": "filenamify-url", | ||
"version": "2.1.2", | ||
"version": "3.0.0", | ||
"description": "Convert a URL to a valid filename", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -35,10 +37,10 @@ "scripts": { | ||
"dependencies": { | ||
"filenamify": "^4.3.0", | ||
"humanize-url": "^2.1.1" | ||
"filenamify": "^5.0.1", | ||
"humanize-url": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"tsd": "^0.11.0", | ||
"xo": "^0.25.3" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -14,3 +14,3 @@ # filenamify-url | ||
```js | ||
const filenamifyUrl = require('filenamify-url'); | ||
import filenamifyUrl from 'filenamify-url'; | ||
@@ -17,0 +17,0 @@ filenamifyUrl('http://sindresorhus.com/foo?bar=baz'); |
Sorry, the diff of this file is not supported yet
Yes
3382
24
+ Addedescape-string-regexp@5.0.0(transitive)
+ Addedfilename-reserved-regex@3.0.0(transitive)
+ Addedfilenamify@5.1.1(transitive)
+ Addedhumanize-url@3.0.0(transitive)
+ Addednormalize-url@7.2.0(transitive)
+ Addedstrip-outer@2.0.0(transitive)
+ Addedtrim-repeated@2.0.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfilename-reserved-regex@2.0.0(transitive)
- Removedfilenamify@4.3.0(transitive)
- Removedhumanize-url@2.1.1(transitive)
- Removednormalize-url@4.5.1(transitive)
- Removedstrip-outer@1.0.1(transitive)
- Removedtrim-repeated@1.0.0(transitive)
Updatedfilenamify@^5.0.1
Updatedhumanize-url@^3.0.0