New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

uniquefilename

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniquefilename - npm Package Compare versions

Comparing version

to
1.0.4

51

index.js

@@ -49,3 +49,3 @@ var fs = require('fs');

if(str_len == 0)
if(str_len === 0)
return null;

@@ -56,3 +56,3 @@

while(--str_len >= 0) {
if(str_len == 0) {
if(str_len === 0) {
str += charset.charAt(nbr - 1);

@@ -65,3 +65,3 @@ break;

var initial = 0;
var tmp = 0;
tmp = 0;
for(tmp = str_len - 1; tmp >= 1; tmp--) {

@@ -135,4 +135,20 @@ initial += Math.pow(charset_len, tmp);

if(!options.separator) {
options.separator = '-';
options.separator = options.separator || '-';
options.mode = options.mode || 'numeric';
charsets = {
"alpha": "abcdefghijklmnopqrstuvwxyz",
"alphanumeric": "0123456789abcdefghijklmnopqrstuvwxyz",
"ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"ALPHANUMERIC" : "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
};
if(options.mode != 'numeric') {
if(charsets[options.mode]) {
options.charset = charsets[options.mode];
options.mode = 'charset';
}
else if(options.mode != 'charset' || (options.mode == 'charset' && !options.charset)) {
options.mode = 'numeric';
}
}

@@ -144,29 +160,6 @@

if(!options.mode) {
options.mode = 'numeric';
}
else if(options.mode == 'alpha') {
options.mode = 'charset';
options.charset = 'abcdefghijklmnopqrstuvwxyz';
}
else if(options.mode == 'alphanumeric') {
options.mode = 'charset';
options.charset = '0123456789abcdefghijklmnopqrstuvwxyz';
}
else if(options.mode == 'ALPHA') {
options.mode = 'charset';
options.charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
}
else if(options.mode == 'ALPHANUMERIC') {
options.mode = 'charset';
options.charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
}
else if(options.mode != 'charset' || !options.charset) {
options.mode = 'numeric';
}
return findIncrementalUniqueFilename(file, options, callback);
}
};
module.exports.numberToString = numberToString;
module.exports.stringToNumber = stringToNumber;
{
"name": "uniquefilename",
"version": "1.0.3",
"version": "1.0.4",
"main": "index.js",

@@ -27,5 +27,5 @@ "description": "Finds a unique filename using incremental values",

"devDependencies": {
"mocha": "^2.2.5",
"mocha": "^2.3.0",
"sinon": "^1.16.1"
}
}
# uniquefilename
[![npm version](https://badge.fury.io/js/uniquefilename.svg)](http://badge.fury.io/js/uniquefilename)
[![npm version](https://badge.fury.io/js/uniquefilename.svg)](http://badge.fury.io/js/uniquefilename)
[![bitHound Score](https://www.bithound.io/github/rundef/uniquefilename/badges/score.svg)](https://www.bithound.io/github/rundef/uniquefilename)

@@ -5,0 +6,0 @@ A module to get a unique filename using incremental values.