Questions tagged [ecmascript-2016]

Questions about new features specified in the ECMAScript 2016 specification.

This tag targets ECMAScript 2016, a JavaScript standard previously known as ECMAScript 7. Any proposal that reached stage 4 by Jan 28th, 2016 became part of the new version.

These are:

484 questions
0
votes
1 answer

Chaining observables Angular 5 / Rxjs

I am a bit confused with rxjs operators. I have few api calls that return observable: getCurrentUser(): Observable { return this.http.get(userUrl); } tagsList(): Observable { return this.http.get(tagsUrl); …
mr__brainwash
  • 1,334
  • 3
  • 16
  • 40
0
votes
3 answers

javascript: Inserting Arrays into object one by one

I need to insert the arrays like locations,commodities into an object which is in this case is refdata. I need to insert the array to object one by one ..as i have done in the code below:- But i am not getting the desired output.Any help will be…
AConsumer
  • 2,461
  • 2
  • 25
  • 33
0
votes
1 answer

Shim ES3 to ES7 ??? something like Babel?

please, I need your help: I have this problem: I'm working with an old system in asp.net, the Javascript for these aspx pages was implemented with ES3 so I cant run these pages on Microsoft Edge (ES7). I need something similar to babel but with…
0
votes
1 answer

How is it possible to interpolate a JavaScript variable based on React state into another variable?

I have a React component pulling from a file with images, copy, and other data needed for the app. The issue I'm coming up against is simply syntactical: how can I reference this data based on the state of the component? data.js looks like this…
0
votes
1 answer

Refactoring picking fields from one object and assigning them to other

If I have book object with following structure {title: string, author: string, genre: string, read: boolean} and I have the req.body that has all the fields from book object as well as few others. Is there a way to refactor following code to more…
zmii
  • 4,123
  • 3
  • 40
  • 64
0
votes
0 answers

Dependency Injection for nodeJs/es6/es7

I would like to accomplish dependency injection in my node/express/es project. I am a newbie to this. Please help Now my code is being like this import ClassA from 'classA'; const classA = new ClassA(); classA.doThing(); exports = module.exports =…
Gibi
  • 451
  • 1
  • 3
  • 12
0
votes
2 answers

.includes() on part of an object

So I have an object of goals. And I wanna see if one specific goal is inside. I'm doing this: for (let i = 0; i < this.goalsHome.length; i++) { console.log(this.goalsHome[i].includes(goal)); } Which results in an error includes does not exists…
Sanne
  • 182
  • 2
  • 15
0
votes
0 answers

What is "@" in ES7 Syntax?

I was reading up on react-dnd and it offers code examples in es5, es6 and es7. Under the es7 example, it give the following code: @DragSource(ItemTypes.CARD, cardSource, (connect, monitor) => ({ connectDragSource: connect.dragSource(), …
dthree
  • 19,847
  • 14
  • 77
  • 106
0
votes
1 answer

import for front end development

I would like to use the features of ES2016 for my front end development. Especially import and decorators are interesting for me. I’ve started a small test project and created some different files with classes which I include with import. Babel…
Pablo Christiano
  • 365
  • 3
  • 21
0
votes
1 answer

Is it possible to refactor React-Navigator Elements?

I'm learning the ropes with React Native and React Navigator at the moment and I've come across something in development where I feel like I want to implement the DRY (don't repeat yourself) technique. Here's my component code: export default class…
0
votes
2 answers

Aurelia minimal project for work inside Browser (no http server)

How to set a Aurelia minimal project for work inside Browser (no http server) how to set a bare minimum aurelia system/boilerplate to work just inside browser (no NodeJS) mainly for understanding/learning purpouses no NodeJS (using just Javascript…
ZEE
  • 2,931
  • 5
  • 35
  • 47
0
votes
5 answers

Merge two objects, but explicitly define the keys that can be set

I want to merge two objects into a new object, with one object overwriting properties if both have them. This is very easy to do with ES6 spreads, but in this particular case I would like to use a method that still defines what keys can be set.…
Don P
  • 60,113
  • 114
  • 300
  • 432
0
votes
3 answers

What is this syntax in ES6 or ES7?

I came across this syntax which I believe is ES6 or ES7. What do these lines of code do? module.exports = async (taskData) => { // do stuff }
N Sharma
  • 33,489
  • 95
  • 256
  • 444
0
votes
1 answer

Can I procedurally export ESmodules using destructuring?

I have a file that default exports an object containing constants. I'd also like to export each of the properties of the object. Is there a way to do this that doesn't involve writing them all out? import keyMirror from 'keymirror'; //…
CodeOcelot
  • 3,403
  • 3
  • 22
  • 23
0
votes
1 answer

Webpack react HMR without router

I need to start react js project without react-router, but I cannot setup hot module replacement without that one, please can you help me. My server const app = express() // Apply gzip compression app.use(compress()) if (project.env ===…