You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -242,7 +242,7 @@ const elements = Immutable.List([
242
242
Get the value of the specified `object` at the `key`, which may be an integer in the case of lists/arrays or strings in the case of maps/objects. E.g.:
243
243
244
244
```js
245
-
constget(object, key) {
245
+
constget=(object, key)=> {
246
246
// must check type because some props may be immutable and others may not be
247
247
if (Immutable.Map.isMap(object) ||Immutable.List.isList(object)) {
248
248
returnobject.get(key);
@@ -255,15 +255,15 @@ const get(object, key) {
255
255
The default is:
256
256
257
257
```js
258
-
constget (object, key) => object[key];
258
+
constget=(object, key) => object[key];
259
259
```
260
260
261
261
### `toJson(object)`
262
262
263
263
Get the deep value of the specified `object` as non-stringified JSON. E.g.:
264
264
265
265
```js
266
-
consttoJson(object){
266
+
consttoJson=(object)=>{
267
267
// must check type because some props may be immutable and others may not be
268
268
if (Immutable.isImmutable(object)) {
269
269
returnobject.toJSON();
@@ -276,17 +276,15 @@ const toJson(object){
276
276
The default is:
277
277
278
278
```js
279
-
consttoJson(object) = object;
279
+
consttoJson=(object) => object;
280
280
```
281
281
282
282
### `diff(objectA, objectB)`
283
283
284
284
Return whether the two objects have equal value. This is used to determine if and where Cytoscape needs to be patched. E.g.:
285
285
286
286
```js
287
-
constdiff(objectA, objectB){
288
-
returnobjectA !== objectB; // immutable creates new objects for each operation
289
-
}
287
+
constdiff= (objectA, objectB) => objectA !== objectB; // immutable creates new objects for each operation
290
288
```
291
289
292
290
The default is a shallow equality check over the fields of each object. This means that if you use the default `diff()`, you should not use arrays or objects in an element's `data` or `scratch` fields.
@@ -298,9 +296,7 @@ Immutable benefits performance here by reducing the total number of `diff()` cal
298
296
Call `iterator` on each element in the `list`, in order. E.g.:
299
297
300
298
```js
301
-
constforEach(list, iterator){
302
-
returnlist.forEach(iterator); // same for immutable and js arrays
303
-
}
299
+
constforEach= (list, iterator) =>list.forEach(iterator); // same for immutable and js arrays
304
300
```
305
301
306
302
The above example is the same as the default `forEach()`.
@@ -312,7 +308,7 @@ The above example is the same as the default `forEach()`.
312
308
The `cy` prop allows for getting a reference to the `cy` Cytoscape object, e.g.:
0 commit comments