velocious 1.0.58 → 1.0.60
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/package.json
CHANGED
|
@@ -212,18 +212,31 @@ class VelociousDatabaseRecord {
|
|
|
212
212
|
|
|
213
213
|
const camelizedColumnName = inflection.camelize(column.getName(), true)
|
|
214
214
|
const camelizedColumnNameBigFirst = inflection.camelize(column.getName())
|
|
215
|
-
const setterMethodName = `set${camelizedColumnNameBigFirst}`
|
|
216
215
|
|
|
217
216
|
this._attributeNameToColumnName[camelizedColumnName] = column.getName()
|
|
218
217
|
this._columnNameToAttributeName[column.getName()] = camelizedColumnName
|
|
219
218
|
|
|
220
|
-
this.prototype[camelizedColumnName] = function
|
|
219
|
+
this.prototype[camelizedColumnName] = function() {
|
|
221
220
|
return this.readAttribute(camelizedColumnName)
|
|
222
221
|
}
|
|
223
222
|
|
|
224
|
-
this.prototype[
|
|
223
|
+
this.prototype[`set${camelizedColumnNameBigFirst}`] = function(newValue) {
|
|
225
224
|
return this._setColumnAttribute(camelizedColumnName, newValue)
|
|
226
225
|
}
|
|
226
|
+
|
|
227
|
+
this.prototype[`has${camelizedColumnNameBigFirst}`] = function() {
|
|
228
|
+
let value = this[camelizedColumnName]()
|
|
229
|
+
|
|
230
|
+
if (typeof value == "string") {
|
|
231
|
+
value = value.trim()
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (value) {
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return false
|
|
239
|
+
}
|
|
227
240
|
}
|
|
228
241
|
|
|
229
242
|
await this._defineTranslationMethods()
|
package/src/logger.js
CHANGED
|
@@ -2,19 +2,31 @@ import Configuration from "./configuration.js"
|
|
|
2
2
|
|
|
3
3
|
function consoleLog(message) {
|
|
4
4
|
return new Promise((resolve) => {
|
|
5
|
-
process.stdout
|
|
5
|
+
if (process.stdout) {
|
|
6
|
+
process.stdout.write(`${message}\n`, "utf8", resolve)
|
|
7
|
+
} else {
|
|
8
|
+
console.log(message)
|
|
9
|
+
}
|
|
6
10
|
})
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
function consoleError(message) {
|
|
10
14
|
return new Promise((resolve) => {
|
|
11
|
-
process.stderr
|
|
15
|
+
if (process.stderr) {
|
|
16
|
+
process.stderr.write(`${message}\n`, "utf8", resolve)
|
|
17
|
+
} else {
|
|
18
|
+
console.error(message)
|
|
19
|
+
}
|
|
12
20
|
})
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
function consoleWarn(message) {
|
|
16
24
|
return new Promise((resolve) => {
|
|
17
|
-
process.stderr
|
|
25
|
+
if (process.stderr) {
|
|
26
|
+
process.stderr.write(`${message}\n`, "utf8", resolve)
|
|
27
|
+
} else {
|
|
28
|
+
console.warn(message)
|
|
29
|
+
}
|
|
18
30
|
})
|
|
19
31
|
}
|
|
20
32
|
|