Re: Feature proposal

2018-07-18 Thread Isiah Meadows
Just a note: there does exist a destructive method to do this: `Array.prototype.reverse()` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse - Isiah Meadows m...@isiahmeadows.com www.isiahmeadows.com On Wed, Jul 18, 2018 at 2:43 PM, Mike Samuel

Re: JSON support for BigInt in Chrome/V8

2018-07-18 Thread Andrew Paprocki
On Wed, Jul 18, 2018 at 5:03 AM, J Decker wrote: > > > Well; Since JSON (JavaScript Object Notation) there's now available to JS > a feature that an 'n' suffix can be applied to a number. Seems JSON should > just inherit that. > json.org states: "It is based on a subset of the JavaScript

Re: JSON support for BigInt in Chrome/V8

2018-07-18 Thread Isiah Meadows
This won't work > > ``` desired object > { a : 123, b : 123n } > ``` > > ``` json > { "a":123 , > "b":123 } > ``` > > function test( json ) { >var c = json.a * 5; >var BIc = json.b * 5n; > } > > if long numbers only translate to bigint (and small as Number); the calc for > 'BIc'

Re: Small Proposal "!in"

2018-07-18 Thread Mike Samuel
On Wed, Jul 18, 2018 at 11:05 AM Michael Theriot < michael.lee.ther...@gmail.com> wrote: > I think `in` and `instanceof` could both benefit from having negated > versions. > > Assuming the developer is using `in` correctly, hasOwnProperty concerns > are irrelevant. Either way they would attempt

Small Proposal "!in"

2018-07-18 Thread Michael Theriot
I think `in` and `instanceof` could both benefit from having negated versions. Assuming the developer is using `in` correctly, hasOwnProperty concerns are irrelevant. Either way they would attempt to use !(a in b), not !hasOwnProperty. Same reason we don't use... !(a == b) // a != b !(a === b)

Fwd: Small Proposal "!in"

2018-07-18 Thread Mike Samuel
[sorry dropped group] On Fri, Jul 13, 2018 at 11:36 AM wrote: > This may be a silly idea that doesn't come naturally to others, but the > first thing I thought of was "!n", where the "!" represents a flipped > "i", so the inverse of in. > You'd need yet another restricted production which

Re: Feature proposal

2018-07-18 Thread T.J. Crowder
On Wed, Jul 18, 2018 at 6:31 PM, Michael Luder-Rosefield < rosyatran...@gmail.com> wrote: > Is strikes me that every single Array method that takes an iteratee function > (signature (value, index, array)) should be able to iterate through the > array in reverse, in a standardised way. Yeah, I had

Re: es-discuss Digest, Vol 137, Issue 46

2018-07-18 Thread Dmitry Shulgin
I partially agree with Michael Luder-Rosefield. The main reason I started this thread is consistency. Because I can't get the logic behind what Michael listed above. I don't think I can support the idea of `iterOrder`. Looks like a try to create silver bullet and I don't think it's a handy way to

Re: Feature proposal

2018-07-18 Thread Nicolas B. Pierron
On Wed, Jul 18, 2018 at 5:31 PM, Michael Luder-Rosefield wrote: > At the moment, we have: > > every > filter > find > findIndex > forEach > indexOf / lastIndexOf > map > reduce / reduceRight > some > > which is not very consistent at all. Perhaps we could add an `iterOrder` > method that changes

Feature proposal

2018-07-18 Thread Dmitry Shulgin
Sorry, I got lost. I partially agree with Michael Luder-Rosefield. The main reason I started this thread is consistency. Because I can't get the logic behind what Michael listed above. I don't think I can support the idea of `iterOrder`. Looks like a try to create silver bullet and I don't think

Re: Feature proposal

2018-07-18 Thread Mike Samuel
On Wed, Jul 18, 2018 at 2:06 PM Nicolas B. Pierron < nicolas.b.pier...@mozilla.com> wrote: > On Wed, Jul 18, 2018 at 5:31 PM, Michael Luder-Rosefield > wrote: > > At the moment, we have: > > > > every > > filter > > find > > findIndex > > forEach > > indexOf / lastIndexOf > > map > > reduce /

Fwd: Feature proposal

2018-07-18 Thread Dmitry Shulgin
-- Forwarded message -- From: Dmitry Shulgin Date: 2018-07-05 10:36 GMT+03:00 Subject: Feature proposal To: es-discuss@mozilla.org I came across a task of finding an index of the last element in array that satisfies the condition, so i reversed array and found it by *findIndex *

Re: JSON support for BigInt in Chrome/V8

2018-07-18 Thread J Decker
On Tue, Jul 17, 2018 at 9:16 PM Isiah Meadows wrote: > The way this conversation is going, we might as well just create a > schema-based JSON serialization DSL for both parsing and stringifying. > But I don't really see that as helpful in the *language itself* at > least as a mandatory part of

Re: Small Proposal "!in"

2018-07-18 Thread Mike Samuel
On Wed, Jul 18, 2018 at 12:21 PM Michael Theriot < michael.lee.ther...@gmail.com> wrote: > I think it is irrelevant; the operator already exists and I would assume > if you want the negation of it you are using it correctly in the first > place. Otherwise are you not just arguing for its removal

Re: Feature proposal

2018-07-18 Thread Cyril Auburtin
there you go ``` console.log([7, 4, 6, 7, 12].findIndex((_, i, a) => isPrime(a[a.length-1-i]))); // 3 ``` Le mer. 18 juil. 2018 à 11:17, Dmitry Shulgin a écrit : > > -- Forwarded message -- > From: Dmitry Shulgin > Date: 2018-07-05 10:36 GMT+03:00 > Subject: Feature proposal >

Re: Feature proposal

2018-07-18 Thread Cyril Auburtin
sorry you get 1, and need again to subtract the array length, `arr.length -1 - 1` to get the final result 3 Le mer. 18 juil. 2018 à 18:41, Cyril Auburtin a écrit : > there you go > ``` > console.log([7, 4, 6, 7, 12].findIndex((_, i, a) => > isPrime(a[a.length-1-i]))); // 3 > ``` > > Le mer. 18

Re: Feature proposal

2018-07-18 Thread Michael Luder-Rosefield
Is strikes me that every single Array method that takes an iteratee function (signature (value, index, array)) should be able to iterate through the array in reverse, in a standardised way. At the moment, we have: - every - filter - find - findIndex - forEach - indexOf /

Re: Feature proposal

2018-07-18 Thread T.J. Crowder
On Wed, Jul 18, 2018 at 5:44 PM, Cyril Auburtin wrote: > sorry you get 1, and need again to subtract the array length, `arr.length -1 > - 1` to get the final result 3 So you can't just use the passed-in third argument, and need: ```js let a = [7, 4, 6, 7, 12]; console.log(a.length - 1 -

Re: Small Proposal "!in"

2018-07-18 Thread Michael Theriot
I think it is irrelevant; the operator already exists and I would assume if you want the negation of it you are using it correctly in the first place. Otherwise are you not just arguing for its removal altogether? But to answer your question one case that comes to mind is trapping get/has in a

Re: Ranges

2018-07-18 Thread Cyril Auburtin
I really like this possible new syntax for ranges: ```js [2:9] // [2,3,4,5,6,7,8,9] [1, 2, 4:7, 9] // [1, 2, 4, 5, 6, 7, 9] [1:6:2] // [1, 3, 5] ``` Would someone in TC39 be up to champion this? ___ es-discuss mailing list es-discuss@mozilla.org