Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change Node get methods to getters #1079

Closed
ianstormtaylor opened this issue Sep 7, 2017 · 1 comment
Closed

change Node get methods to getters #1079

ianstormtaylor opened this issue Sep 7, 2017 · 1 comment

Comments

@ianstormtaylor
Copy link
Owner

ianstormtaylor commented Sep 7, 2017

Right now when using State you can do:

state.blocks
state.text
state.marks
...

But with Nodes you have to do:

node.getBlocks()
node.getMarks()
node.isLeafBlock()
...

It would be nice to change this so that we stay consistent IMO.

A list of candidates:

  'getBlocks',
  'getBlocksAsArray',
  'getCharacters',
  'getCharactersAsArray',
  'getFirstText',
  'getInlines',
  'getInlinesAsArray',
  'getKeys',
  'getLastText',
  'getMarks',
  'getOrderedMarks',
  'getMarksAsArray',
  'getText',
  'getTextDirection',
  'getTexts',
  'getTextsAsArray',
  'isLeafBlock',
  'isLeafInline',

The complication is just figuring out how to handle the inheritance of getters, and then how to memoize them more performantly since they take no arguments.

@ianstormtaylor
Copy link
Owner Author

Given that we will be forced to do this with #2495 we can close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant