filenamify
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -1,30 +0,37 @@ | ||
export interface Options { | ||
/** | ||
* String to use as replacement for reserved filename characters. | ||
* | ||
* Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` | ||
* | ||
* @default '!' | ||
*/ | ||
readonly replacement?: string; | ||
declare namespace filenamify { | ||
interface Options { | ||
/** | ||
String to use as replacement for reserved filename characters. | ||
Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` | ||
@default '!' | ||
*/ | ||
readonly replacement?: string; | ||
} | ||
} | ||
/** | ||
* Accepts a filename and returns a valid filename. | ||
* | ||
* @param input - A string to convert to a valid filename. | ||
*/ | ||
export interface Filenamify { | ||
(input: string, options?: Options): string; | ||
declare const filenamify: { | ||
/** | ||
Convert a string to a valid filename. | ||
@example | ||
``` | ||
import filenamify = require('filenamify'); | ||
filenamify('<foo/bar>'); | ||
//=> 'foo!bar' | ||
filenamify('foo:"bar"', {replacement: '🐴'}); | ||
//=> 'foo🐴bar' | ||
``` | ||
*/ | ||
(string: string, options?: filenamify.Options): string; | ||
/** | ||
* Accepts a path and returns the path with a valid filename. | ||
* | ||
* @param input - A string to convert to a valid path with a filename. | ||
*/ | ||
path(input: string, options?: Options): string; | ||
} | ||
Convert the filename in a path a valid filename and return the augmented path. | ||
*/ | ||
path(path: string, options?: filenamify.Options): string; | ||
}; | ||
declare const filenamify: Filenamify; | ||
export default filenamify; | ||
export = filenamify; |
@@ -45,2 +45,1 @@ 'use strict'; | ||
module.exports = filenamify; | ||
module.exports.default = filenamify; |
{ | ||
"name": "filenamify", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Convert a string to a valid safe filename", | ||
@@ -13,6 +13,6 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -38,10 +38,10 @@ "files": [ | ||
"filename-reserved-regex": "^2.0.0", | ||
"strip-outer": "^1.0.0", | ||
"strip-outer": "^1.0.1", | ||
"trim-repeated": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"tsd-check": "^0.3.0", | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -30,16 +30,10 @@ # filenamify [![Build Status](https://travis-ci.org/sindresorhus/filenamify.svg?branch=master)](https://travis-ci.org/sindresorhus/filenamify) | ||
### filenamify(input, [options]) | ||
### filenamify(string, [options]) | ||
Accepts a filename and returns a valid filename. | ||
Convert a string to a valid filename. | ||
### filenamify.path(input, [options]) | ||
### filenamify.path(path, [options]) | ||
Accepts a path and returns the path with a valid filename. | ||
Convert the filename in a path a valid filename and return the augmented path. | ||
#### input | ||
Type: `string` | ||
A string to convert to a valid filename. | ||
#### options | ||
@@ -46,0 +40,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
62
5608
64
Updatedstrip-outer@^1.0.1