Questions tagged [ecmascript-2017]

Use this tag for questions about features finalized in ECMAScript 2017. Do *not* use this tag if the code in question merely *uses* one of the features, *unless* the feature is cause of the problem.

Proposals finalized in 2017 include:

387 questions
0
votes
1 answer

how ES7 import module's object in Node.js

var GoogleStrategy = require('passport-google-oauth20').Strategy; How can I use ES2017's way to write it? I try import GoogleStrategy from ('passport-google-oauth20').Strategy But it couldn't work How can I use ES7 to write it? Thanks here is the…
user20345646
0
votes
0 answers

How to upgrade es2017 to es2020 without upgrading angular version?

I want to upgrade es2017 to es2020, but I don't want to upgrade angular version. Is it possible? My angular version is 5.2.
erzen
  • 384
  • 1
  • 6
  • 18
0
votes
1 answer

How to throw "expressive" / console friendly exceptions in JavaScript?

JavaScript noob here... I'm exploring various options for throwing exceptions. Throwing a string / primitive value This seems to be bad practice for several reasons (catching, stacktrace, ...) Using Error throw new Error("bad times") This seems to…
aioobe
  • 413,195
  • 112
  • 811
  • 826
0
votes
2 answers

ECMAScript 8, async await, syntactical errors javascript

using more then one async() in a chain in the function breaks my function. Is there a way i can include Key2pkcs8() inside generateKey() ? async function generateKey() { let getKeyPair = await crypto.subtle.generateKey( { name: "ECDH", …
cubesareneat
  • 302
  • 2
  • 14
0
votes
0 answers

How to determine the goal symbol when tokenize ECMAScript in lexical grammar

I'm writing a JS macro preprocessor, and refer to the ECMA-262 specification for some guide to parse js code. I use the code parser to determine where to do macro replace in a standard/precise way, which will distinguish some environments…
0
votes
3 answers

How to find repeated values and store repeated values into new array in javascript

I am trying to implement a logic where I have an array [3,4,63,5,5,1,5,2,63,2,4,5,6,2,4,56,74,2,671,1,4,5,7,3,6] . I want to find all repeated elements and I want to store these all repeated elements into a new array. I tried very hard but didn't…
Jonas
  • 71
  • 8
0
votes
1 answer

How to make a separate a sync function wait for another async function?

I am unable to callback async function inside of another async function. I am receiving this in the console: Promise {} __proto__: Promise [[PromiseState]]: "fulfilled" [[PromiseResult]]: Object script.js:127 TypeError: Cannot read…
0
votes
1 answer

Transform/map json to another format

Have long JSON object and small part is below: const valueObject = {zipCode: 12345, street1: 'street 1', street2: 'street 2',city:'cityname', uniqueNum: '123456789'}; const mappingObject = {address: {pinCode: zipCode, addressLine1: 'street1',…
TechS
  • 167
  • 1
  • 5
  • 14
0
votes
1 answer

TypeError: Cannot read property 'onMouse' of undefined React Class Component

I want to do when the user clicks on Input Element and the button element in the form will change to Send icon from the microphone icon. My idea was to get the value from onClick or mouseEnter handler and pass it through the if-else statement and…
0
votes
1 answer

Why does Number.parseInt('111AAA') works like its supposed to in JS ? What is the reasoning behind this behaviour?

If I execute parseInt('111AAA') we get the output '111'. In javascript why does parseInt work as its mentioned in the MDN docs. The parseInt function converts its first argument to a string, parses it, and returns an integer or NaN. If not NaN, the…
slick
  • 65
  • 8
0
votes
1 answer

es6/7 shorthand for assigning properties from object to HTMLElement

What would be a shorthand for the following: setupIframeConfig(element: HTMLIFrameElement, config: IFrameConfig){ element.src = config.src; element.width = config.width; element.width = config.width; } using rest wont do it because it…
Tomas Katz
  • 1,653
  • 1
  • 13
  • 27
0
votes
2 answers

ES2017 NEST JS @IsEmpty Unable to resolve signature of property decorator when called as an expression.This expression is not callable. is not empty

Hi people im newer with Nest JS and i trying to add dto validator but for example when i tried to add isNotEmpty or Max compiler show me this error: Unable to resolve signature of property decorator when called as an expression. This expression…
Daniel ORTIZ
  • 2,488
  • 3
  • 21
  • 41
0
votes
2 answers

Turn callback to promise and using of `await`

I've found this sample snippets in this article :