-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
730db95
commit 0844b3a
Showing
8 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export const isFunction = x => typeof x === 'function' | ||
|
||
export function isPojo(target) { | ||
const Ctor = target.constructor | ||
|
||
return ( | ||
!!target | ||
&& | ||
typeof target === 'object' | ||
&& | ||
Object.prototype.toString.call(target) === '[object Object]' | ||
&& | ||
isFunction(Ctor) | ||
&& | ||
(Ctor instanceof Ctor || target.type === 'AltStore') | ||
) | ||
} | ||
|
||
export function eachObject(f, o) { | ||
o.forEach((from) => { | ||
Object.keys(Object(from)).forEach((key) => { | ||
f(key, from[key]) | ||
}) | ||
}) | ||
} | ||
|
||
export function assign(target, ...source) { | ||
eachObject((key, value) => target[key] = value, source) | ||
return target | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters