theprogrammablemind_4wp 7.5.8-beta.6 → 7.5.8-beta.61
Sign up to get free protection for your applications and to get access to all the features.
- package/client.js +205 -208
- package/index.js +1 -0
- package/package.json +1 -1
- package/src/config.js +465 -215
- package/src/flatten.js +9 -1
- package/src/helpers.js +3 -1
- package/src/semantics.js +6 -1
package/src/flatten.js
CHANGED
@@ -89,7 +89,15 @@ const flatten = (markers, value) => {
|
|
89
89
|
const split = markers.includes(marker)
|
90
90
|
if (split) {
|
91
91
|
if ('value' in properties) {
|
92
|
-
|
92
|
+
flattenedValues = []
|
93
|
+
for (let v of properties.value) {
|
94
|
+
if (v.flatten) {
|
95
|
+
flattenedValues = flattenedValues.concat(flatten(markers, v)[0])
|
96
|
+
} else {
|
97
|
+
flattenedValues.push(v)
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return [flattenedValues, true]
|
93
101
|
} else {
|
94
102
|
return [[value], false]
|
95
103
|
}
|
package/src/helpers.js
CHANGED
@@ -53,6 +53,8 @@ const safeEquals = (v1, v2) => {
|
|
53
53
|
return v1 == v2
|
54
54
|
} else if (type == 'function') {
|
55
55
|
return v1.toString() == v2.toString()
|
56
|
+
} else if (v1 == undefined || v2 == undefined) {
|
57
|
+
return v1 == v2
|
56
58
|
} else {
|
57
59
|
if (v1.length != v2.length) {
|
58
60
|
return false
|
@@ -320,7 +322,7 @@ const ecatch = (where, call) => {
|
|
320
322
|
try {
|
321
323
|
return call()
|
322
324
|
} catch( e ) {
|
323
|
-
throw new Error(`${where} ${e}`)
|
325
|
+
throw new Error(`${where} ${e.stack}`)
|
324
326
|
}
|
325
327
|
}
|
326
328
|
|
package/src/semantics.js
CHANGED
@@ -6,7 +6,7 @@ class Semantic {
|
|
6
6
|
// constructor ({match, apply, uuid, index, km, notes}) {
|
7
7
|
constructor (semantic) {
|
8
8
|
semantic = normalizeSemantic(semantic)
|
9
|
-
const { match, apply, uuid, index, km, notes, priority, debug, where, applyWrapped, property } = semantic
|
9
|
+
const { match, apply, uuid, index, km, notes, priority, debug, where, applyWrapped, property, oneShot, id } = semantic
|
10
10
|
this.matcher = match
|
11
11
|
this._apply = apply
|
12
12
|
this._applyWrapped = applyWrapped
|
@@ -18,6 +18,8 @@ class Semantic {
|
|
18
18
|
this.notes = notes
|
19
19
|
this.callId = debug
|
20
20
|
this.where = where
|
21
|
+
this.oneShot = oneShot
|
22
|
+
this.id = id
|
21
23
|
}
|
22
24
|
|
23
25
|
toLabel () {
|
@@ -197,6 +199,9 @@ class Semantics {
|
|
197
199
|
const log = (message) => { this.logs.push(message) }
|
198
200
|
try {
|
199
201
|
contextPrime = semantic.apply(args, context, s, log, options)
|
202
|
+
if (!contextPrime.controlKeepMotivation && semantic.oneShot) {
|
203
|
+
args.config.removeSemantic(semantic)
|
204
|
+
}
|
200
205
|
} catch( e ) {
|
201
206
|
contextPrime = null
|
202
207
|
let errorMessage
|