Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ec0b82de00 | |||
5e69664f59 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstring",
|
"name": "@pushrocks/smartstring",
|
||||||
"version": "3.0.6",
|
"version": "3.0.7",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartstring",
|
"name": "@pushrocks/smartstring",
|
||||||
"version": "3.0.6",
|
"version": "3.0.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "handle strings in smart ways. TypeScript ready.",
|
"description": "handle strings in smart ways. TypeScript ready.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -3,11 +3,11 @@ import * as plugins from './smartstring.plugins';
|
|||||||
/**
|
/**
|
||||||
* replaces all occurences of something in a string
|
* replaces all occurences of something in a string
|
||||||
* @param stringArg
|
* @param stringArg
|
||||||
* @param searchRegExp
|
* @param searchPattern
|
||||||
* @param replacementString
|
* @param replacementString
|
||||||
*/
|
*/
|
||||||
export const replaceAll = (stringArg: string, searchRegExp: any, replacementString: string) => {
|
export const replaceAll = (stringArg: string, searchPattern: string, replacementString: string) => {
|
||||||
return stringArg.replace(new RegExp(searchRegExp, 'g'), replacementString);
|
return stringArg.replace(new RegExp(searchPattern, 'g'), replacementString);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,6 +17,6 @@ export const replaceAll = (stringArg: string, searchRegExp: any, replacementStri
|
|||||||
export const standard = (stringArg: string): string => {
|
export const standard = (stringArg: string): string => {
|
||||||
let fix1 = plugins.stripIndent(stringArg); // fix indention
|
let fix1 = plugins.stripIndent(stringArg); // fix indention
|
||||||
let fix2 = plugins.normalizeNewline(fix1); // fix newlines
|
let fix2 = plugins.normalizeNewline(fix1); // fix newlines
|
||||||
let fix3 = replaceAll(fix2, /\t/, ' '); // fix tabs
|
let fix3 = replaceAll(fix2, '\t/', ' '); // fix tabs
|
||||||
return fix3;
|
return fix3;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user