UNPKG
fliphub-monorepo
Version:
latest (0.1.3)
0.1.3
0.1.2
the builder of builders
github.com/fliphub/fliphub
fliphub/fliphub
fliphub-monorepo
/
packages
/
fliphub-helpers
/
src
/
obj
/
initClassOrObj.js
8 lines
(6 loc)
•
224 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
module.exports =
function
initClassOrObj
(
Obj,
args
, method
)
{
if
(!method) method =
'init'
if
(toString.call(Obj) ===
'[object Function]'
)
return
new
Obj(
args
)
if
(Obj[method])
return
Obj[method](
args
)
return
Obj }