atom.io 0.23.3 → 0.23.5
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/immortal/dist/index.cjs
CHANGED
|
@@ -96,11 +96,11 @@ var Molecule = class _Molecule {
|
|
|
96
96
|
}
|
|
97
97
|
detach(child) {
|
|
98
98
|
const childIndex = this.below.indexOf(child);
|
|
99
|
-
if (childIndex !==
|
|
99
|
+
if (childIndex !== -1) {
|
|
100
100
|
this.below.splice(childIndex, 1);
|
|
101
101
|
}
|
|
102
102
|
const parentIndex = child.above.indexOf(this);
|
|
103
|
-
if (parentIndex !==
|
|
103
|
+
if (parentIndex !== -1) {
|
|
104
104
|
child.above.splice(parentIndex, 1);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -169,7 +169,19 @@ function makeMoleculeInStore(store, context, family, key, ...params) {
|
|
|
169
169
|
family
|
|
170
170
|
};
|
|
171
171
|
const contextArray = Array.isArray(context) ? context : [context];
|
|
172
|
-
const owners = contextArray.map((ctx) =>
|
|
172
|
+
const owners = contextArray.map((ctx) => {
|
|
173
|
+
if (ctx instanceof Molecule) {
|
|
174
|
+
return ctx;
|
|
175
|
+
}
|
|
176
|
+
const stringKey = json.stringifyJson(ctx.key);
|
|
177
|
+
const molecule2 = store.molecules.get(stringKey);
|
|
178
|
+
if (!molecule2) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
`Molecule ${stringKey} not found in store "${store.config.name}"`
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
return molecule2;
|
|
184
|
+
});
|
|
173
185
|
const Formula = Internal__namespace.withdraw(family, store);
|
|
174
186
|
const molecule = new Formula(owners, token, ...params);
|
|
175
187
|
target.molecules.set(json.stringifyJson(key), molecule);
|
package/immortal/dist/index.js
CHANGED
|
@@ -57,11 +57,11 @@ var Molecule = class _Molecule {
|
|
|
57
57
|
}
|
|
58
58
|
detach(child) {
|
|
59
59
|
const childIndex = this.below.indexOf(child);
|
|
60
|
-
if (childIndex !==
|
|
60
|
+
if (childIndex !== -1) {
|
|
61
61
|
this.below.splice(childIndex, 1);
|
|
62
62
|
}
|
|
63
63
|
const parentIndex = child.above.indexOf(this);
|
|
64
|
-
if (parentIndex !==
|
|
64
|
+
if (parentIndex !== -1) {
|
|
65
65
|
child.above.splice(parentIndex, 1);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -130,7 +130,19 @@ function makeMoleculeInStore(store, context, family, key, ...params) {
|
|
|
130
130
|
family
|
|
131
131
|
};
|
|
132
132
|
const contextArray = Array.isArray(context) ? context : [context];
|
|
133
|
-
const owners = contextArray.map((ctx) =>
|
|
133
|
+
const owners = contextArray.map((ctx) => {
|
|
134
|
+
if (ctx instanceof Molecule) {
|
|
135
|
+
return ctx;
|
|
136
|
+
}
|
|
137
|
+
const stringKey = stringifyJson(ctx.key);
|
|
138
|
+
const molecule2 = store.molecules.get(stringKey);
|
|
139
|
+
if (!molecule2) {
|
|
140
|
+
throw new Error(
|
|
141
|
+
`Molecule ${stringKey} not found in store "${store.config.name}"`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
return molecule2;
|
|
145
|
+
});
|
|
134
146
|
const Formula = Internal.withdraw(family, store);
|
|
135
147
|
const molecule = new Formula(owners, token, ...params);
|
|
136
148
|
target.molecules.set(stringifyJson(key), molecule);
|
|
@@ -107,9 +107,21 @@ export function makeMoleculeInStore<
|
|
|
107
107
|
} as const satisfies MoleculeToken<Key, Struct, Params>
|
|
108
108
|
|
|
109
109
|
const contextArray = Array.isArray(context) ? context : [context]
|
|
110
|
-
const owners = contextArray
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const owners = contextArray.map<Molecule<any>>((ctx) => {
|
|
111
|
+
if (ctx instanceof Molecule) {
|
|
112
|
+
return ctx
|
|
113
|
+
}
|
|
114
|
+
const stringKey = stringifyJson(ctx.key)
|
|
115
|
+
const molecule = store.molecules.get(stringKey)
|
|
116
|
+
|
|
117
|
+
if (!molecule) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Molecule ${stringKey} not found in store "${store.config.name}"`,
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
return molecule
|
|
123
|
+
})
|
|
124
|
+
|
|
113
125
|
const Formula = Internal.withdraw(family, store)
|
|
114
126
|
const molecule = new Formula(owners, token, ...params)
|
|
115
127
|
target.molecules.set(stringifyJson(key), molecule)
|
package/immortal/src/molecule.ts
CHANGED
|
@@ -111,11 +111,11 @@ export class Molecule<Key extends Json.Serializable> {
|
|
|
111
111
|
|
|
112
112
|
public detach(child: Molecule<any>): void {
|
|
113
113
|
const childIndex = this.below.indexOf(child)
|
|
114
|
-
if (childIndex !==
|
|
114
|
+
if (childIndex !== -1) {
|
|
115
115
|
this.below.splice(childIndex, 1)
|
|
116
116
|
}
|
|
117
117
|
const parentIndex = child.above.indexOf(this)
|
|
118
|
-
if (parentIndex !==
|
|
118
|
+
if (parentIndex !== -1) {
|
|
119
119
|
child.above.splice(parentIndex, 1)
|
|
120
120
|
}
|
|
121
121
|
}
|