JSPM

strip-filename-increment

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 88889
  • Score
    100M100P100Q172069F
  • License MIT

Strips the numerical increment and/or the word `copy` that is automatically generated and added to the end of a filename by an operating system Works with windows and mac-OS style increments. Useful for doing file comparisons, looking for dupes, etc.

Package Exports

  • strip-filename-increment

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strip-filename-increment) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

strip-filename-increment NPM version NPM monthly downloads NPM total downloads Linux Build Status

Strips the numerical increment and/or the word copy that is automatically generated and added to the end of a filename by an operating system Works with windows and mac-OS style increments. Useful for doing file comparisons, looking for dupes, etc.

Install

Install with npm:

$ npm install --save strip-filename-increment

Usage

var stripIncrement = require('strip-filename-increment');

Does NOT strip non-increments

console.log(stripIncrement('foo 1'));
//=> 'foo 1'
console.log(stripIncrement('foo [1]'));
//=> 'foo [1]'
console.log(stripIncrement('foo (1) 1'));
//=> 'foo (1) 1'

Windows-style increments

All of the following would return foo

console.log(stripIncrement('foo (1)'));  
console.log(stripIncrement('foo (2)'));  
console.log(stripIncrement('foo (22)')); 

All of the following would return foo.txt

console.log(stripIncrement('foo (1).txt'));  
console.log(stripIncrement('foo (2).txt'));  
console.log(stripIncrement('foo (22).txt')); 

mac OS-style increments

All of the following would return foo

console.log(stripIncrement('foo copy'));
console.log(stripIncrement('foo copy 1'));
console.log(stripIncrement('foo copy 2'));
console.log(stripIncrement('foo copy 21'));
console.log(stripIncrement('foo copy 219 copy 219'));

All of the following would return foo.txt

console.log(stripIncrement('foo copy.txt'));
console.log(stripIncrement('foo copy 1.txt'));
console.log(stripIncrement('foo copy 2.txt'));
console.log(stripIncrement('foo copy 21.txt'));
console.log(stripIncrement('foo copy 219 copy 219.txt'));

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for advice on opening issues, pull requests, and coding standards.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on July 02, 2017.