Category "ecmascript-6"

MUI next Tooltip does not show on hover

I use Material-UIv1.0.0-beta.34 Tooltip with Checkbox and FormControlLabel, actually when I hover to the label on Checkbox in one case the tooltip shows as expe

How do I set multiple values in a Javascript Map at once?

I have a simple chain of logic here, where bigCities is a Javascript Map. In this example, d represents each object in an array of data read in from a csv file.

Expected to return a value in arrow; function array-callback-return. Why?

I'm having some issues understanding why I'm getting a compile warning on this piece of my react code fetch('/users') .then(res => res.json())

ecmascript 6 syntax for declaring prototype default values using Class

When creating classes in javascript, you can set a default value by accessing the function's prototype. function Foo() { } Foo.prototype.get = func

Is it possible to stop prettier from adding an extra tab for .then() {} statements after Promise.try?

So, I was wondering if it is possible to stop prettier from adding an extra tab for .then() {} statements after Promise.try or just simple return PromiseFn() .t

Export default was not found

I have a Vue 2 project, and I've written a simple function for translating months in dates, which I would like to import in one of my components, but I'm gettin

Is the Immediately-Invoked Function Expression (IIFE) pattern really necessary when writing userscripts?

My question is quite similar to What is the purpose of a self executing function in javascript?, however it concerns userscripts (specifically for GreaseMonkey)

Property 'entries' does not exist on type 'ObjectConstructor'

I'm working on an ng2 implementation. I'm using the following function call to convert an object to an array: var authors = Object.entries(responseObject.Author

Capitalize the first word (or optionally all the words) of a sentence in angular 2+

I am trying to capitalize words of a string in the angular 2 template (aka view) but I get the following error in the console and the application does not load

Stuck with eslint Error i.e Separately, loops should be avoided in favor of array iterations

I have the Code for some iterations and it works well. After installing eslint, One of my code generates an error by eslint. My code is: for (const column of

Can ES6 template literals be substituted at runtime (or reused)?

tl;dr: Is it possible to make a reusable template literal? I've been trying to use template literals but I guess I just don't get it and now I'm getting frustr

Expected 'this' to be used by class method

In my class, eslint is complaining "Expected 'this' to be used by class method 'getUrlParams' Here is my class: class PostSearch extends React.Component { c

How to iterate over keys of a generic object in TypeScript?

I need to iterate over a large object which is just typed as "object". It contains an unknown number of objects of the same type. In older posts I had found so

const vs let when calling require

As io.js now supports ES6 you are finally able to use the const and let keywords. Obviously, let is the successor of var, just with some super-powers. But what

ES6 Modules : Importing a module in an Angular component

I have an ES6 module where I am exporting a library. I want to be able to use this module in an Angular component. I cannot have the library files locally withi

ES6 Modules : Importing a module in an Angular component

I have an ES6 module where I am exporting a library. I want to be able to use this module in an Angular component. I cannot have the library files locally withi

How to change swipe direction in swiper.js?

I'm struggling with changing swipe direction when I rotate my swiper on 90deg. So in the beginning by default it has horizontal direction. When clicking on sli

flatten nested object using lodash

flatten, flattenDeep or flattenDepth of lodash only accept array. How to flatten nested object? var data = { "dates": { "expiry_date": "30 sep 2018",

Rollup is importing util

I am building a library to be used to call api's I am using rollup to bundle all the files into one file, the issue is its adding this line import util from 'ut

Is Node.js worker_threads module truly threads or just processes with IPC?

Recent Node.js versions contain the new module worker_threads which is said to bring multi-threading to Node.js. However, it seems using processes underhood: ht