theprogrammablemind 7.10.0 → 7.10.1

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/src/unflatten.js CHANGED
@@ -36,7 +36,7 @@ const concatLists = (l1, l2) => {
36
36
 
37
37
  const findPropertyWithManyValues = (contexts, properties) => {
38
38
  for (const property of properties) {
39
- if (new Set(contexts.map( (context) => context[property] )).size == 1) {
39
+ if (new Set(contexts.map((context) => context[property])).size == 1) {
40
40
  return property
41
41
  }
42
42
  }
@@ -77,23 +77,23 @@ class JSONSet {
77
77
  // x wants and likes y C
78
78
 
79
79
  const canonicalDefault = (value) => {
80
- if (!value || !value.marker) {
81
- return value;
82
- }
83
- return { marker: value.marker, value: value.value, word: value.wordi, types: value.types }
80
+ if (!value || !value.marker) {
81
+ return value
82
+ }
83
+ return { marker: value.marker, value: value.value, word: value.wordi, types: value.types }
84
84
  }
85
85
 
86
86
  // if properties null then check the contexts for unflatten property
87
87
  const unflatten = (contexts, properties, canonical = canonicalDefault) => {
88
88
  const grouped = {}
89
- for (let context of contexts) {
89
+ for (const context of contexts) {
90
90
  if (!grouped[context.marker]) {
91
91
  grouped[context.marker] = []
92
92
  }
93
93
  grouped[context.marker].push(context)
94
94
  }
95
95
  let results = []
96
- for (let key in grouped) {
96
+ for (const key in grouped) {
97
97
  results = results.concat(unflattenHelper(grouped[key], properties || grouped[key][0].unflatten, canonical))
98
98
  }
99
99
  return results