Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "fun-model", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "fun-model is pure functional implementation of FLUX architecture.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -1,1 +0,1 @@ | ||
export declare function shallowCopy<T>(source: T, callback?: (target: T) => void): T; | ||
export declare function shallowCopy<T>(source: T, callback?: (target: T) => void | T): T; |
@@ -6,6 +6,6 @@ function shallowCopy(source, callback = (t) => { }) { | ||
target[property] = source[property]; | ||
callback(target); | ||
return target; | ||
let result = callback(target); | ||
return result || target; | ||
} | ||
exports.shallowCopy = shallowCopy; | ||
; |
@@ -1,2 +0,2 @@ | ||
export function shallowCopy<T>(source: T, callback: (target: T) => void = (t: T) => { }): T { | ||
export function shallowCopy<T>(source: T, callback: (target: T) => void | T = (t: T) => { }): T { | ||
let target = <T>{}; | ||
@@ -6,5 +6,5 @@ for (var property in source) | ||
target[property] = source[property]; | ||
callback(target); | ||
return target; | ||
let result = callback(target); | ||
return <T>result || target; | ||
}; | ||
170094