filenamify
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -11,2 +11,11 @@ declare namespace filenamify { | ||
readonly replacement?: string; | ||
/** | ||
Truncate the filename to the given length. | ||
Systems generally allow up to 255 characters, but we default to 100 for usability reasons. | ||
@default 100 | ||
*/ | ||
readonly maxLength?: number; | ||
} | ||
@@ -13,0 +22,0 @@ } |
@@ -34,3 +34,3 @@ 'use strict'; | ||
string = filenameReservedRegex.windowsNames().test(string) ? string + replacement : string; | ||
string = string.slice(0, MAX_FILENAME_LENGTH); | ||
string = string.slice(0, typeof options.maxLength === 'number' ? options.maxLength : MAX_FILENAME_LENGTH); | ||
@@ -37,0 +37,0 @@ return string; |
{ | ||
"name": "filenamify", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Convert a string to a valid safe filename", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -51,3 +51,12 @@ # filenamify [![Build Status](https://travis-ci.org/sindresorhus/filenamify.svg?branch=master)](https://travis-ci.org/sindresorhus/filenamify) | ||
##### maxLength | ||
Type: `boolean`<br> | ||
Default: `100` | ||
Truncate the filename to the given length. | ||
Systems generally allow up to 255 characters, but we default to 100 for usability reasons. | ||
## Related | ||
@@ -54,0 +63,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
6059
68
73