sindresorhus/define-lazy-prop

Decorator

Open

#1 opened on Jan 16, 2017

View on GitHub
 (5 comments) (5 reactions) (0 assignees)JavaScript (67 stars) (6 forks)user submission
enhancementhelp wanted

Description

A decorator would be perfect for this.

I'd like to wait until the Decorator proposal is stage 3 though.

Example:

const lazy = require('define-lazy-prop/decorator');

class Unicorn {
	@lazy rainbow() {
		return 'Lazily computed value';
	}
}

Contributor guide