A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/robsontenorio/vue-api-query/commit/644ab4e8a1a6ab9b1e450c8a1e770a324b93cd8c below:

use `typeof` instead of `constructor` for checks · robsontenorio/vue-api-query@644ab4e · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+3

-3

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+3

-3

lines changed Original file line number Diff line number Diff line change

@@ -83,12 +83,12 @@ export default class Builder {

83 83

}

84 84 85 85

// single entity .select(['age', 'firstname'])

86 -

if (fields[0].constructor === String || Array.isArray(fields[0])) {

86 +

if (typeof fields[0] === 'string' || Array.isArray(fields[0])) {

87 87

this.fields[this.model.resource()] = fields.join(',')

88 88

}

89 89 90 90

// related entities .select({ posts: ['title', 'content'], user: ['age', 'firstname']} )

91 -

if (fields[0].constructor === Object) {

91 +

if (typeof fields[0] === 'object') {

92 92

Object.entries(fields[0]).forEach(([key, value]) => {

93 93

this.fields[key] = value.join(',')

94 94

})

@@ -161,7 +161,7 @@ export default class Builder {

161 161

}

162 162 163 163

params(payload) {

164 -

if (payload === undefined || payload.constructor !== Object) {

164 +

if (payload === undefined || typeof payload !== 'object') {

165 165

throw new Error('You must pass a payload/object as param.')

166 166

}

167 167

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4