Socket
Socket
Sign inDemoInstall

filenamify-url

Package Overview
Dependencies
7
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

5

index.d.ts

@@ -18,6 +18,9 @@ import {Options} from 'filenamify';

//=> 'sindresorhus.com🐴foo'
filenamifyUrl(new URL('http://sindresorhus.com'));
//=> 'sindresorhus.com'
```
*/
export default function filenamifyUrl(url: string, options?: Options): string;
export default function filenamifyUrl(url: string | URL, options?: Options): string;
export {Options} from 'filenamify';

8

index.js
import filenamify from 'filenamify';
import humanizeUrl from 'humanize-url';
export default function filenamifyUrl(string, options) {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
export default function filenamifyUrl(url, options) {
if (!(typeof url === 'string' || url instanceof URL)) {
throw new TypeError('Expected a string or URL instance');
}
return filenamify(decodeURIComponent(humanizeUrl(string)), options);
return filenamify(decodeURIComponent(humanizeUrl(url.toString())), options);
}
{
"name": "filenamify-url",
"version": "3.0.0",
"version": "3.1.0",
"description": "Convert a URL to a valid filename",

@@ -15,2 +15,4 @@ "license": "MIT",

"exports": "./index.js",
"types": "./index.d.ts",
"sideEffects": false,
"engines": {

@@ -17,0 +19,0 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"

@@ -7,5 +7,5 @@ # filenamify-url

```sh
npm install filenamify-url
```
$ npm install filenamify-url
```

@@ -22,2 +22,5 @@ ## Usage

//=> 'sindresorhus.com🐴foo'
filenamifyUrl(new URL('http://sindresorhus.com'));
//=> 'sindresorhus.com'
```

@@ -33,3 +36,3 @@

Type: `string`
Type: `string | URL`

@@ -43,1 +46,7 @@ A URL to convert to a valid filename.

See the [`filenamify` options](https://github.com/sindresorhus/filenamify#options).
## Related
- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this module
- [filenamify](https://github.com/sindresorhus/filenamify) - Convert a string to a valid safe filename
- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc