Comparing version 0.7.0 to 0.8.0
23
ideas.md
@@ -5,2 +5,7 @@ # Ideas | ||
## colors | ||
- hsl color conversions | ||
- color array generation | ||
## password | ||
@@ -11,2 +16,11 @@ | ||
## whitespace | ||
- remove all | ||
- remove extra spaces | ||
- remove tabs | ||
- swap methods for various whitespace | ||
- split methods for tabs, new lines, and carriage returns | ||
- combine method that takes array and returns as string delimited by new lines. Maybe even have options starting line with a hyphen like in a md list. | ||
## escapes | ||
@@ -24,6 +38,13 @@ | ||
## Duplicates | ||
## words | ||
- remove duplicates | ||
- return duplicate count | ||
- return word count | ||
- return character count | ||
- swap words | ||
- specific word count | ||
## File Path | ||
## Zipcode |
@@ -0,5 +1,14 @@ | ||
import { IReplaceWith } from '../models/whitespace.model'; | ||
declare function removeBreaks(str: string): string; | ||
declare function removeTabs(str: string): string; | ||
declare function removeAll(str: string): string; | ||
declare function singleSpace(str: string): string; | ||
declare function replaceWith(str: string, toReplace: IReplaceWith, newStr: string): string; | ||
declare const whitespace: { | ||
removeAll: typeof removeAll; | ||
removeBreaks: typeof removeBreaks; | ||
removeTabs: typeof removeTabs; | ||
replaceWith: typeof replaceWith; | ||
singleSpace: typeof singleSpace; | ||
}; | ||
export { whitespace }; |
@@ -7,5 +7,31 @@ "use strict"; | ||
} | ||
function removeTabs(str) { | ||
return common_1.common.remove(str, /\t|\\t/gim); | ||
} | ||
function removeAll(str) { | ||
return common_1.common.remove(str, /\t|\\t|\n|\\n|\r|\\r| /gim); | ||
} | ||
function singleSpace(str) { | ||
return str.replace(/ +/gm, ' '); | ||
} | ||
function replaceWith(str, toReplace, newStr) { | ||
let result = str; | ||
if (toReplace.tabs) { | ||
result = result.replace(/\t|\\t/gim, newStr); | ||
} | ||
if (toReplace.breaks) { | ||
result = result.replace(/\n|\r|\\r|\\n/gim, newStr); | ||
} | ||
if (toReplace.multiSpace) { | ||
result = result.replace(/ +/gm, newStr); | ||
} | ||
return result; | ||
} | ||
const whitespace = { | ||
removeBreaks | ||
removeAll, | ||
removeBreaks, | ||
removeTabs, | ||
replaceWith, | ||
singleSpace | ||
}; | ||
exports.whitespace = whitespace; |
{ | ||
"name": "stringman", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Stringman does string manipulation. Do anything from lightening color codes to swapping email address in a string!", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,4 +5,6 @@ # Stringman | ||
Stringman is in the very early stages right now and I am still figuring out how I want to structure this and what functionality to include. Examples of the type of functionality include (but are not limited to): | ||
Stringman is in the early stages right now and I am adding functionality fairly regularly while making so I don't make breaking changes to existing methods. | ||
Examples of the type of functionality include (but are not limited to): | ||
- validate whether string is url | ||
@@ -15,3 +17,3 @@ - return text from inside of parenthesis | ||
Also, typescript types are included. | ||
Also, typescript types are included. A full list of funtionality/features is below. | ||
@@ -103,1 +105,5 @@ ## Install | ||
- removeBreaks => Takes a string and returns that string with all carriage returns and line breaks removed | ||
- removeTabs => Takes a string and returns that string with alltabs removed | ||
- removeAll => Takes a string and returns that string with all whitespace removed | ||
- singleSpace => Takes a string, replaces all instances or 2 or more consecutive spaces with a single space, and returns string | ||
- replaceWith => Takes a string, an enumerable object with boolean values to detrermine what will be replaced, and another string to replace things with and returns the result of replacing the values designated in the 2nd argument with the contents of the 3 argument |
27126
30
579
107