@bouko/ts 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
1
  export declare const shortenStr: (str: string) => string;
2
2
  export declare const shortenNum: (x: number) => string;
3
3
  export declare const cleanStr: (str: string) => string;
4
+ export declare const stripStr: (str: string, noise: string[]) => string;
@@ -16,3 +16,8 @@ export const cleanStr = (str) => str
16
16
  .replace(/[^\w!?.)]+$/g, "") // trailing junk
17
17
  .replace(/\s+/g, " ") // collapse spaces
18
18
  .trim();
19
+ export const stripStr = (str, noise) => {
20
+ for (const word of noise)
21
+ str = str.replace(new RegExp(word, "gi"), "");
22
+ return cleanStr(str.replace("()", ""));
23
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/ts",
4
- "version": "0.4.1",
4
+ "version": "0.4.2",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "MIT",