cronvel / terminal-kit

Terminal utilities for node.js
MIT License
3.09k stars 200 forks source link

Easily create custom properties #165

Open TheBrenny opened 3 years ago

TheBrenny commented 3 years ago

Chaining is a super handy thing, and even better is that I can chain styles and movements together and assign that chain to a variable (one of the reasons which convinced me btw! 🤩)

But while doing things like center = (str) => term.left(str.length / 2)(str) is fun and easy, I'd love to be able to assign it to the Terminal.prototype in a way where I can still chain it to other chainable functions/properties

That way we can start doing things like:

term.assign({
  center: function(str) {
    return this.left(str.length / 2)(str);
  }
})

Or something similar.