Skip to content

Commit 513ba59

Browse files
Fix const xxx(x, y) {…} and similar pseudo-code
1 parent ce2d717 commit 513ba59

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ This prop allows for getting a reference to the Cytoscape `cy` reference using a
152152
```jsx
153153
class MyApp extends React.Component {
154154
render() {
155-
return <CytoscapeComponent cy={cy => this.cy = cy}>;
155+
return <CytoscapeComponent cy={(cy) => { this.cy = cy }}>;
156156
}
157157
}
158158
```
@@ -242,7 +242,7 @@ const elements = Immutable.List([
242242
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.:
243243

244244
```js
245-
const get(object, key) {
245+
const get = (object, key) => {
246246
// must check type because some props may be immutable and others may not be
247247
if (Immutable.Map.isMap(object) || Immutable.List.isList(object)) {
248248
return object.get(key);
@@ -255,15 +255,15 @@ const get(object, key) {
255255
The default is:
256256

257257
```js
258-
const get (object, key) => object[key];
258+
const get = (object, key) => object[key];
259259
```
260260

261261
### `toJson(object)`
262262

263263
Get the deep value of the specified `object` as non-stringified JSON. E.g.:
264264

265265
```js
266-
const toJson(object){
266+
const toJson = (object) => {
267267
// must check type because some props may be immutable and others may not be
268268
if (Immutable.isImmutable(object)) {
269269
return object.toJSON();
@@ -276,17 +276,15 @@ const toJson(object){
276276
The default is:
277277

278278
```js
279-
const toJson(object) = object;
279+
const toJson = (object) => object;
280280
```
281281

282282
### `diff(objectA, objectB)`
283283

284284
Return whether the two objects have equal value. This is used to determine if and where Cytoscape needs to be patched. E.g.:
285285

286286
```js
287-
const diff(objectA, objectB){
288-
return objectA !== objectB; // immutable creates new objects for each operation
289-
}
287+
const diff = (objectA, objectB) => objectA !== objectB; // immutable creates new objects for each operation
290288
```
291289

292290
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
298296
Call `iterator` on each element in the `list`, in order. E.g.:
299297

300298
```js
301-
const forEach(list, iterator){
302-
return list.forEach(iterator); // same for immutable and js arrays
303-
}
299+
const forEach = (list, iterator) => list.forEach(iterator); // same for immutable and js arrays
304300
```
305301

306302
The above example is the same as the default `forEach()`.
@@ -312,7 +308,7 @@ The above example is the same as the default `forEach()`.
312308
The `cy` prop allows for getting a reference to the `cy` Cytoscape object, e.g.:
313309

314310
```jsx
315-
<CytoscapeComponent cy={cy => (myCyRef = cy)} />
311+
<CytoscapeComponent cy={(cy) => { myCyRef = cy }} />
316312
```
317313

318314
## Change log

0 commit comments

Comments
 (0)