@contrail/util
Advanced tools
Comparing version 1.0.27 to 1.0.28
@@ -0,0 +0,0 @@ import { getIsoDatePart } from "./getIsoDatePart/getIsoDatePart"; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function getIsoDatePart(date: Date): string; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export * from './object-util/object-util'; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare class MapUtil { | ||
static keyBy(array: any[], variableString: any): {}; | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function applyChangesIfEqual(target: any, priorSourceValues: any, newSourceValues: any, propertyKeys: any): void; | ||
export declare function determineChangesIfEqual(target: any, priorSourceValues: any, newSourceValues: any, propertyKeys: any): any; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function cloneDeep(obj: any): any; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export interface ObjectDiff { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare const item1Assortment1: { |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function isObject(item: any): boolean; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function mergeDeep(target: any, ...sources: any[]): any; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { cloneDeep } from './cloneDeep/cloneDeep'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare class StringUtil { |
@@ -13,15 +13,13 @@ "use strict"; | ||
static parseVariables(variableString, data, quoteStrings = false) { | ||
const regExp = /\{([^}]+)\}/; | ||
let done = false; | ||
let currentVariableString = variableString; | ||
while (!done) { | ||
const match = regExp.exec(currentVariableString); | ||
if (!match) { | ||
done = true; | ||
break; | ||
} | ||
const variableLevels = match[1].split('.'); | ||
const regExp = /\{([^}]+)\}/g; | ||
const replacedString = variableString.replace(regExp, (match, group) => { | ||
const variableLevels = group.split('.'); | ||
let replacementValue = data; | ||
for (let i = 0; i < variableLevels.length; i++) { | ||
replacementValue = replacementValue[variableLevels[i]]; | ||
if (replacementValue) { | ||
replacementValue = replacementValue[variableLevels[i]]; | ||
} | ||
else { | ||
replacementValue = undefined; | ||
} | ||
} | ||
@@ -41,5 +39,8 @@ if (quoteStrings && StringUtil.isString(replacementValue)) { | ||
} | ||
currentVariableString = currentVariableString.replace(match[0], replacementValue); | ||
} | ||
return currentVariableString; | ||
if (Object.prototype.toString.call(replacementValue) === '[object Object]') { | ||
replacementValue = JSON.stringify(replacementValue); | ||
} | ||
return replacementValue; | ||
}); | ||
return replacedString; | ||
} | ||
@@ -46,0 +47,0 @@ static convertToCamelCase(str) { |
{ | ||
"name": "@contrail/util", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"description": "General javascript utilities", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
550
20459