@kaspernj/api-maker 1.0.139 → 1.0.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +7 -0
- package/package.json +1 -1
- package/src/model-recipes.cjs.erb +2 -0
- package/src/models.cjs +0 -2
- package/src/money-formatter.cjs +9 -0
- package/src/routes-native.cjs +2 -1
package/.eslintrc.js
CHANGED
|
@@ -68,15 +68,20 @@ module.exports = {
|
|
|
68
68
|
"init-declarations": "off",
|
|
69
69
|
"jest/max-nested-describe": "error",
|
|
70
70
|
"jest/no-alias-methods": "error",
|
|
71
|
+
"jest/no-conditional-in-test": "error",
|
|
71
72
|
"jest/no-duplicate-hooks": "error",
|
|
72
73
|
"jest/no-hooks": "off",
|
|
73
74
|
"jest/no-if": "error",
|
|
74
75
|
"jest/no-large-snapshots": "error",
|
|
75
76
|
"jest/no-restricted-matchers": "error",
|
|
76
77
|
"jest/no-test-return-statement": "error",
|
|
78
|
+
"jest/prefer-comparison-matcher": "error",
|
|
79
|
+
"jest/prefer-equality-matcher": "error",
|
|
77
80
|
"jest/prefer-expect-resolves": "off", // Needs configuration and no documentation could be found?
|
|
78
81
|
"jest/prefer-hooks-on-top": "error",
|
|
79
82
|
"jest/prefer-lowercase-title": "off",
|
|
83
|
+
"prefer-object-has-own": "error",
|
|
84
|
+
"jest/prefer-snapshot-hint": "error",
|
|
80
85
|
"jest/prefer-to-be": "off", // Needs configuration and no documentation could be found?
|
|
81
86
|
"jest/prefer-spy-on": "error",
|
|
82
87
|
"jest/prefer-to-contain": "error",
|
|
@@ -212,6 +217,8 @@ module.exports = {
|
|
|
212
217
|
"react/forbid-foreign-prop-types": "error",
|
|
213
218
|
"react/forbid-prop-types": "off",
|
|
214
219
|
"react/function-component-definition": "error",
|
|
220
|
+
"react/hook-use-state": "error",
|
|
221
|
+
"react/iframe-missing-sandbox": "error",
|
|
215
222
|
"react/jsx-boolean-value": "error",
|
|
216
223
|
"react/jsx-child-element-spacing": "error",
|
|
217
224
|
"react/jsx-closing-bracket-location": "error",
|
package/package.json
CHANGED
package/src/models.cjs
CHANGED
package/src/money-formatter.cjs
CHANGED
|
@@ -54,6 +54,15 @@ module.exports = class MoneyFormatter {
|
|
|
54
54
|
return moneyCurrency
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
static isMoney(value) {
|
|
58
|
+
if (value instanceof Money) return true
|
|
59
|
+
|
|
60
|
+
if (typeof value == "object" && value && Object.keys(value).length == 2 && value.amount && value.currency)
|
|
61
|
+
return true
|
|
62
|
+
|
|
63
|
+
return false
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
constructor (money, args = {}) {
|
|
58
67
|
this.args = args
|
|
59
68
|
this.money = money
|
package/src/routes-native.cjs
CHANGED
|
@@ -97,7 +97,8 @@ module.exports = class ApiMakerRoutesNative {
|
|
|
97
97
|
if (pathPart.type == "pathPart") {
|
|
98
98
|
return pathPart.name
|
|
99
99
|
} else if (pathPart.type == "variable") {
|
|
100
|
-
|
|
100
|
+
// Args might not contain the right amount of variables, so dont change this to 'digg'
|
|
101
|
+
return dig(args, digg(pathPart, "count"))
|
|
101
102
|
} else {
|
|
102
103
|
throw new Error(`Unhandled path part type: ${pathPart.type}`)
|
|
103
104
|
}
|