Comparing version 0.6.1 to 0.7.0
@@ -9,2 +9,3 @@ import { colors } from './source/colors'; | ||
import { url } from './source/url'; | ||
export { colors, email, ip, numbers, parens, pwd, semver, url }; | ||
import { whitespace } from './source/whitespace'; | ||
export { colors, email, ip, numbers, parens, pwd, semver, url, whitespace }; |
@@ -19,1 +19,3 @@ "use strict"; | ||
exports.url = url_1.url; | ||
const whitespace_1 = require("./source/whitespace"); | ||
exports.whitespace = whitespace_1.whitespace; |
@@ -1,2 +0,2 @@ | ||
declare function retrieve(str: string): string | null; | ||
declare function retrieve(str: string): string[]; | ||
declare function isValid(str: string): boolean; | ||
@@ -3,0 +3,0 @@ declare function remove(str: string): string; |
@@ -6,4 +6,3 @@ "use strict"; | ||
function retrieve(str) { | ||
const matched = str.match(getEmail); | ||
return matched && matched.length ? matched[0] : null; | ||
return common_1.common.retrieve(str, getEmail); | ||
} | ||
@@ -14,3 +13,3 @@ function isValid(str) { | ||
function remove(str) { | ||
return str.replace(getEmail, '').trim(); | ||
return common_1.common.remove(str, getEmail); | ||
} | ||
@@ -17,0 +16,0 @@ function swap(str, newEmail) { |
@@ -10,6 +10,3 @@ "use strict"; | ||
function retrieve(str) { | ||
if (typeof str !== 'string') { | ||
return []; | ||
} | ||
return str.match(ipAddrContains) || []; | ||
return common_1.common.retrieve(str, ipAddrContains); | ||
} | ||
@@ -23,6 +20,3 @@ function expression(global) { | ||
function remove(str) { | ||
if (typeof str !== 'string') { | ||
return ''; | ||
} | ||
return str.replace(ipAddrContains, '').trim(); | ||
return common_1.common.remove(str, ipAddrContains); | ||
} | ||
@@ -29,0 +23,0 @@ function swap(str, newStr) { |
@@ -38,3 +38,3 @@ "use strict"; | ||
} | ||
return common_1.common.isValid(num.toString(), /^-?\d*\/\d+$/g); | ||
return common_1.common.isValid(num, /^-?\d*\/\d+$/g); | ||
} | ||
@@ -41,0 +41,0 @@ function containsFraction(num) { |
declare function remove(str: string): string; | ||
declare function inside(str: string): string[]; | ||
declare function swap(str: string, other: string): string; | ||
declare const parens: { | ||
inside: typeof inside; | ||
remove: typeof remove; | ||
swap: typeof swap; | ||
}; | ||
export { parens }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common_1 = require("./utility/common"); | ||
function remove(str) { | ||
return str.replace(/ *\([^)]*\) */g, '').trim(); | ||
return common_1.common.remove(str, / *\([^)]*\) */g); | ||
} | ||
@@ -10,6 +11,10 @@ function inside(str) { | ||
} | ||
function swap(str, other) { | ||
return common_1.common.swap(str, other, /\(([^()]+)\)/g); | ||
} | ||
const parens = { | ||
inside, | ||
remove | ||
remove, | ||
swap | ||
}; | ||
exports.parens = parens; |
declare function retrieve(str: string): RegExpMatchArray; | ||
declare function isValid(str: string): boolean; | ||
declare function remove(str: string): string; | ||
declare function swap(str: string, newVer: string): string; | ||
declare function expression(): RegExp; | ||
@@ -10,3 +11,4 @@ declare const semver: { | ||
retrieve: typeof retrieve; | ||
swap: typeof swap; | ||
}; | ||
export { semver }; |
@@ -6,3 +6,3 @@ "use strict"; | ||
function retrieve(str) { | ||
return str.match(semverStr) || []; | ||
return common_1.common.retrieve(str, semverStr); | ||
} | ||
@@ -13,4 +13,7 @@ function isValid(str) { | ||
function remove(str) { | ||
return str.replace(semverStr, '').trim(); | ||
return common_1.common.remove(str, semverStr); | ||
} | ||
function swap(str, newVer) { | ||
return common_1.common.swap(str, newVer, semverStr); | ||
} | ||
function expression() { | ||
@@ -23,4 +26,5 @@ return semverStr; | ||
remove, | ||
retrieve | ||
retrieve, | ||
swap | ||
}; | ||
exports.semver = semver; |
declare function retrieve(str: string): string[]; | ||
declare function isValid(str: string): boolean; | ||
declare function remove(str: string): string; | ||
declare function getDomain(str: string): string | null; | ||
declare function swap(str: string, other: string): string; | ||
declare function getDomain(str: string): string[]; | ||
declare function expression(): RegExp; | ||
@@ -12,3 +13,4 @@ declare const url: { | ||
retrieve: typeof retrieve; | ||
swap: typeof swap; | ||
}; | ||
export { url }; |
@@ -7,3 +7,3 @@ "use strict"; | ||
function retrieve(str) { | ||
return str.match(urlStr) || []; | ||
return common_1.common.retrieve(str, urlStr); | ||
} | ||
@@ -14,7 +14,9 @@ function isValid(str) { | ||
function remove(str) { | ||
return str.replace(urlStr, '').trim(); | ||
return common_1.common.remove(str, urlStr); | ||
} | ||
function swap(str, other) { | ||
return common_1.common.swap(str, other, urlStr); | ||
} | ||
function getDomain(str) { | ||
const matched = str.match(domainExp); | ||
return matched && matched.length ? matched[1] : null; | ||
return common_1.common.retrieve(str, domainExp).splice(1); | ||
} | ||
@@ -29,4 +31,5 @@ function expression() { | ||
remove, | ||
retrieve | ||
retrieve, | ||
swap | ||
}; | ||
exports.url = url; |
declare function isValid(str: string, exp: RegExp): boolean; | ||
declare function swap(str: string, str2: string, exp: RegExp): string; | ||
declare function remove(str: string, exp: RegExp): string; | ||
declare function retrieve(str: string, exp: RegExp): string[]; | ||
declare const common: { | ||
isValid: typeof isValid; | ||
remove: typeof remove; | ||
retrieve: typeof retrieve; | ||
swap: typeof swap; | ||
}; | ||
export { common }; |
@@ -17,6 +17,20 @@ "use strict"; | ||
} | ||
function remove(str, exp) { | ||
if (typeof str !== 'string') { | ||
return str; | ||
} | ||
return str.replace(exp, '').trim(); | ||
} | ||
function retrieve(str, exp) { | ||
if (typeof str !== 'string') { | ||
return []; | ||
} | ||
return str.match(exp) || []; | ||
} | ||
const common = { | ||
isValid, | ||
remove, | ||
retrieve, | ||
swap | ||
}; | ||
exports.common = common; |
{ | ||
"name": "stringman", | ||
"version": "0.6.1", | ||
"description": "Stringman does a lot of string manipulation and regex operations for you.", | ||
"version": "0.7.0", | ||
"description": "Stringman does string manipulation. Do anything from lightening color codes to swapping email address in a string!", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "types": "lib/index.d.ts", |
@@ -71,2 +71,3 @@ # Stringman | ||
- inside => Takes string and returns array of strings containing what was inside any number of sets of parenthesis | ||
- swap => Takes 2 strings, swaps anything in parenthesis INCLUDING THE PARENTHESIS from the first string with the second string | ||
@@ -87,2 +88,3 @@ #### password module | ||
- expression => Returns RegExp variable used to test for semantic version | ||
- swap => takes 2 strings and returns string with any semantic versions in the first string replaced by the second string | ||
@@ -96,1 +98,6 @@ #### url module | ||
- expression => Returns RegExp for testing URLs | ||
- swap => takes a string with a url and a second string, swaps any urls in the first string with the second string, and returns the result | ||
#### whitespace module | ||
- removeBreaks => Takes a string and returns that string with all carriage returns and line breaks removed |
24721
28
537
101