Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

safename

Get safe file name from a given string.

Build Status

Example

// require only in node/browserify
var safename = require( 'safename' );

safename('my file name.txt');
// => my_file_name.txt

safename('my file name.txt', '-');
// => my-file-name.txt

safename.low('my file name.txt');
// => my_file_name.txt

safename.middle('my file name.txt');
// => my-file-name.txt

safename.dot('my file name.txt');
// => my.file.name.txt

Installation

Install with npm

$ npm install safename

Install with Bower

$ bower install safename

safename API

safename( name, space )

Get safe name for files

Parameters:

  • name String: string to transform
  • space String: replace for spaces. Optional, low dash ('_') by default
  • Return String: safe name

low( )

Safe name with low dash '_'.

Parameters:

Same as safename('your file name.txt', '_');

middle( )

Safe name with middle dash '-'.

Parameters:

Same as safename('your file name.txt', '-');

dot( )

Safe name with dots '.'.

Parameters:

Same as safename('your file name.txt', '.');

Tests

npm install && npm test

Build API docs

npm install && npm run build-docs




© 2014 jacoborus

Released under MIT License

About

Get safe file name from a given string

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.