From 292dc00ca96ef8d8517add7bca619bb405adc1a6 Mon Sep 17 00:00:00 2001 From: Artem Kobzar Date: Fri, 24 May 2019 18:03:17 +0300 Subject: [PATCH] ReadOnly Arrays --- proposal-template.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/proposal-template.md b/proposal-template.md index c928a70..f897664 100755 --- a/proposal-template.md +++ b/proposal-template.md @@ -1,16 +1,22 @@ -# ECMAScript proposal: @Name +# ECMAScript proposal: Readonly Arays and Objects - [Motivation](#motivation) - [High-level API](#high-level-api) - [FAQ](#faq) ## Motivation -Proposal motivation +Sometimes to prevent object and array changes we should to use `Object.freeze`, but the method very slow, so i propose readonly structure which will be constant by default ## High-level API ```js -// example code +const USER_STATUSES = new ReadOnly([ + "banned", + "active", + "deleted" +]); + +USER_STATUS[0] = "something" // Throw type error ``` ### FAQ