Skip to content

Commit 762f220

Browse files
committed
generic behavior
1 parent fbb1e06 commit 762f220

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hyperportal",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "A pleasant CLI for rapid development with Mongoose.",
55
"main": "src/index.js",
66
"repository":{

src/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ console.log(Object.keys(models).join('\n'))
2525

2626
const objectify = m => x => {
2727
// just always use toJSON for sequelize.
28-
m = isSequelize(x) ? 'toJSON' : m
28+
const invoke = o => (o[m] || o['toJSON']).bind(o)()
2929

30-
if (x[m]) {
31-
return x[m]()
32-
}
3330
if (L.isArray(x)) {
34-
return L.map(x, _ => _[m]())
31+
return L.map(x, invoke)
32+
} else {
33+
return invoke(x)
3534
}
3635
return x
3736
}

0 commit comments

Comments
 (0)