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 2.1.2 to 3.0.0

43

index.d.ts

@@ -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';

@@ -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

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