@bfwk/utils
Advanced tools
Comparing version 0.6.7003 to 0.7.0
@@ -6,13 +6,10 @@ # Change Log | ||
## 0.6.7003 (2021-04-21) | ||
# [0.7.0](https://github.com/salesforce/builder-framework/compare/v0.6.49...v0.7.0) (2021-07-28) | ||
**Note:** Version bump only for package @bfwk/utils | ||
### Features | ||
* refactor from lbf to bfwk @W-9091273 ([#1](https://github.com/salesforce/builder-framework/issues/1)) ([5300a61](https://github.com/salesforce/builder-framework/commit/5300a6117f7f1c763442d7e50d157443e22c1e36)) | ||
## [0.6.7](https://git.soma.salesforce.com/BuilderFramework/builder-framework/compare/v0.6.6...v0.6.7) (2021-04-05) | ||
@@ -19,0 +16,0 @@ |
@@ -289,3 +289,3 @@ import { ValueChangedEvent } from '@lwc/wire-service'; | ||
} | ||
if (!window.URLSearchParams) { | ||
if (typeof window !== 'undefined' && !window.URLSearchParams) { | ||
window.URLSearchParams = CustomURLSearchParams; | ||
@@ -457,6 +457,3 @@ } | ||
const callback = callbacks[i]; | ||
if (callback && | ||
callback.constructor && | ||
callback.call && | ||
callback.apply) { | ||
if (callback && callback.constructor) { | ||
callback(data.mBody); | ||
@@ -1195,2 +1192,28 @@ } | ||
export { Connection, ConnectionManager, CustomURLSearchParams, ExpressionServiceFactory, MessageChannelConnection, Observable, ObservableCreator, PostMessageConnection, Subscription, WireValueChangeObservers, clone, configureObservers, createWireAdapterFactory, formatLabel, generateAdapterId, generateGuid, inverse, isArray, isEqual, isFunction, isObject, isUndefined, isUndefinedOrNull, isValidNumber, labelComparator, labelFilter, multiComparatorGenerator, nameComparator, scrubURLDomain, shallowCopy, stringPropertyComparator, throttle }; | ||
/** | ||
* Performs a deep merge of `source` into `target`. | ||
* Mutates `target` only but not its objects and arrays. | ||
*/ | ||
function mergeDeep(target, source) { | ||
const isObject = (obj) => obj && typeof obj === 'object'; | ||
if (!isObject(target) || !isObject(source)) { | ||
return source; | ||
} | ||
const toReturn = clone(target, true); | ||
Object.keys(source).forEach(key => { | ||
const targetValue = toReturn[key]; | ||
const sourceValue = source[key]; | ||
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { | ||
toReturn[key] = sourceValue; | ||
} | ||
else if (isObject(targetValue) && isObject(sourceValue)) { | ||
toReturn[key] = mergeDeep(Object.assign({}, targetValue), sourceValue); | ||
} | ||
else { | ||
toReturn[key] = sourceValue; | ||
} | ||
}); | ||
return toReturn; | ||
} | ||
export { Connection, ConnectionManager, CustomURLSearchParams, ExpressionServiceFactory, MessageChannelConnection, Observable, ObservableCreator, PostMessageConnection, Subscription, WireValueChangeObservers, clone, configureObservers, createWireAdapterFactory, formatLabel, generateAdapterId, generateGuid, inverse, isArray, isEqual, isFunction, isObject, isUndefined, isUndefinedOrNull, isValidNumber, labelComparator, labelFilter, mergeDeep, multiComparatorGenerator, nameComparator, scrubURLDomain, shallowCopy, stringPropertyComparator, throttle }; |
@@ -288,3 +288,3 @@ import { ValueChangedEvent } from '@lwc/wire-service'; | ||
} | ||
if (!window.URLSearchParams) { | ||
if (typeof window !== 'undefined' && !window.URLSearchParams) { | ||
window.URLSearchParams = CustomURLSearchParams; | ||
@@ -456,6 +456,3 @@ } | ||
const callback = callbacks[i]; | ||
if (callback && | ||
callback.constructor && | ||
callback.call && | ||
callback.apply) { | ||
if (callback && callback.constructor) { | ||
callback(data.mBody); | ||
@@ -1686,2 +1683,28 @@ } | ||
export { Connection, ConnectionManager, CustomURLSearchParams, ExpressionServiceFactory, MessageChannelConnection, Observable, ObservableCreator, PostMessageConnection, ReactiveMembrane, Subscription, WireValueChangeObservers, clone, configureObservers, createWireAdapterFactory, formatLabel, generateAdapterId, generateGuid, inverse, isArray, isEqual, isFunction, isObject, isUndefined, isUndefinedOrNull, isValidNumber, labelComparator, labelFilter, multiComparatorGenerator, nameComparator, scrubURLDomain, shallowCopy, stringPropertyComparator, throttle }; | ||
/** | ||
* Performs a deep merge of `source` into `target`. | ||
* Mutates `target` only but not its objects and arrays. | ||
*/ | ||
function mergeDeep(target, source) { | ||
const isObject = (obj) => obj && typeof obj === 'object'; | ||
if (!isObject(target) || !isObject(source)) { | ||
return source; | ||
} | ||
const toReturn = clone(target, true); | ||
Object.keys(source).forEach(key => { | ||
const targetValue = toReturn[key]; | ||
const sourceValue = source[key]; | ||
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { | ||
toReturn[key] = sourceValue; | ||
} | ||
else if (isObject(targetValue) && isObject(sourceValue)) { | ||
toReturn[key] = mergeDeep(Object.assign({}, targetValue), sourceValue); | ||
} | ||
else { | ||
toReturn[key] = sourceValue; | ||
} | ||
}); | ||
return toReturn; | ||
} | ||
export { Connection, ConnectionManager, CustomURLSearchParams, ExpressionServiceFactory, MessageChannelConnection, Observable, ObservableCreator, PostMessageConnection, ReactiveMembrane, Subscription, WireValueChangeObservers, clone, configureObservers, createWireAdapterFactory, formatLabel, generateAdapterId, generateGuid, inverse, isArray, isEqual, isFunction, isObject, isUndefined, isUndefinedOrNull, isValidNumber, labelComparator, labelFilter, mergeDeep, multiComparatorGenerator, nameComparator, scrubURLDomain, shallowCopy, stringPropertyComparator, throttle }; |
@@ -22,1 +22,2 @@ export { Comparator, stringPropertyComparator, labelComparator, nameComparator, multiComparatorGenerator, } from './sortLib'; | ||
export { inverse } from './inverse'; | ||
export { mergeDeep } from './mergeDeep'; |
@@ -13,3 +13,3 @@ import { WireEventTarget } from '@lwc/wire-service'; | ||
} | ||
export declare function configureObservers<T>(getObservers: (config: any) => HasObservers): (config: any) => Observable | undefined; | ||
export declare function configureObservers(getObservers: (config: any) => HasObservers): (config: any) => Observable | undefined; | ||
export declare function createWireAdapterFactory(getObservable: (config: any) => Observable | undefined, getInitialValue?: (config: any) => () => any): (eventTarget: WireEventTarget) => void; | ||
@@ -16,0 +16,0 @@ /** |
{ | ||
"name": "@bfwk/utils", | ||
"version": "0.6.7003", | ||
"version": "0.7.0", | ||
"description": "LBF Pub Sub", | ||
@@ -9,3 +9,4 @@ "type": "module", | ||
"files": [ | ||
"dist/" | ||
"dist/", | ||
"index.xml" | ||
], | ||
@@ -12,0 +13,0 @@ "publishConfig": { |
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
148741
32
3340