Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Added comment to the node attributes serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarwrobel committed Aug 14, 2018
1 parent e1561b9 commit f2863d5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/model/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ export default class Node {
toJSON() {
const json = {};

// Serializes attributes to the object.
// attributes = { a: 'foo', b: 1, c: true }.
if ( this._attrs.size ) {
json.attributes = Array.from( this._attrs ).reduce( ( result, attr ) => {
result[ attr[ 0 ] ] = attr[ 1 ];
Expand Down

0 comments on commit f2863d5

Please sign in to comment.