filenamify-url
Advanced tools
Comparing version 1.0.0 to 2.0.0
13
index.js
'use strict'; | ||
var filenamify = require('filenamify'); | ||
var humanizeUrl = require('humanize-url'); | ||
const filenamify = require('filenamify'); | ||
const humanizeUrl = require('humanize-url'); | ||
module.exports = function (str, opts) { | ||
if (typeof str !== 'string') { | ||
const filenamifyUrl = (string, options) => { | ||
if (typeof string !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
} | ||
return filenamify(humanizeUrl(str), opts); | ||
return filenamify(humanizeUrl(string), options); | ||
}; | ||
module.exports = filenamifyUrl; | ||
module.exports.default = filenamifyUrl; |
{ | ||
"name": "filenamify-url", | ||
"version": "1.0.0", | ||
"description": "Convert a URL to a valid filename", | ||
"license": "MIT", | ||
"repository": "sindresorhus/filenamify-url", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "node test.js" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"filename", | ||
"file", | ||
"name", | ||
"string", | ||
"str", | ||
"path", | ||
"convert", | ||
"valid", | ||
"dirname", | ||
"url", | ||
"uri", | ||
"address" | ||
], | ||
"dependencies": { | ||
"filenamify": "^1.0.0", | ||
"humanize-url": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4" | ||
} | ||
"name": "filenamify-url", | ||
"version": "2.0.0", | ||
"description": "Convert a URL to a valid filename", | ||
"license": "MIT", | ||
"repository": "sindresorhus/filenamify-url", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"filename", | ||
"file", | ||
"name", | ||
"string", | ||
"path", | ||
"convert", | ||
"valid", | ||
"url", | ||
"uri" | ||
], | ||
"dependencies": { | ||
"filenamify": "^3.0.0", | ||
"humanize-url": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"tsd-check": "^0.3.0", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # filenamify-url [![Build Status](https://travis-ci.org/sindresorhus/filenamify-url.svg?branch=master)](https://travis-ci.org/sindresorhus/filenamify-url) | ||
``` | ||
$ npm install --save filenamify-url | ||
$ npm install filenamify-url | ||
``` | ||
@@ -17,9 +17,9 @@ | ||
```js | ||
var filenamifyUrl = require('filenamify-url'); | ||
const filenamifyUrl = require('filenamify-url'); | ||
filenamifyUrl('http://sindresorhus.com/foo?bar=baz'); | ||
//=> sindresorhus.com!foo!bar=baz | ||
//=> 'sindresorhus.com!foo!bar=baz' | ||
filenamifyUrl('http://sindresorhus.com/foo', {replacement: '🐴'}); | ||
//=> sindresorhus.com🐴foo | ||
//=> 'sindresorhus.com🐴foo' | ||
``` | ||
@@ -30,7 +30,21 @@ | ||
See the [`filenamify` API](https://github.com/sindresorhus/filenamify#api). | ||
### filenamifyUrl(input, [options]) | ||
Accepts a URL and returns a valid filename. | ||
#### input | ||
Type: `string` | ||
A URL to convert to a valid filename. | ||
#### options | ||
Type: `Object` | ||
See the [`filenamify` options](https://github.com/sindresorhus/filenamify#options). | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3298
5
20
48
0
3
+ Addedfilename-reserved-regex@2.0.0(transitive)
+ Addedfilenamify@3.0.0(transitive)
+ Addedhumanize-url@2.1.1(transitive)
+ Addednormalize-url@4.5.1(transitive)
- Removedfilename-reserved-regex@1.0.0(transitive)
- Removedfilenamify@1.2.1(transitive)
- Removedhumanize-url@1.0.1(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removednormalize-url@1.9.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprepend-http@1.0.4(transitive)
- Removedquery-string@4.3.4(transitive)
- Removedsort-keys@1.1.2(transitive)
- Removedstrict-uri-encode@1.1.0(transitive)
- Removedstrip-url-auth@1.0.1(transitive)
Updatedfilenamify@^3.0.0
Updatedhumanize-url@^2.0.0