Questions tagged [ecmascript-6]

ECMAScript 6 reached feature complete status in 2014. The features vary widely from completely new objects and patterns to syntax changes to new methods on existing objects.

78 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
267 views

Object-Oriented Sorting Algorithms

I would like a review of a library I've recently published. I realize this is a rather large request, but having looked on meta, it seems this is perfectly on-topic. I'll include a few choice samples ...
6
votes
1answer
86 views

Return probability (Javascript)

I've been working on a personal project. There's this game called TFT which is an autochess game. Each match is played by 8 players and there's a shared pool of champions, each champion have their ...
6
votes
0answers
111 views

Node.JS Protobuf socket client with TLS support

I'm working with one environment which allows me to execute node.js code from single file without installing additional modules. My task is to write simple ssl socket client which will send protobuf ...
3
votes
0answers
60 views

JavaScript attempt at an aspect oriented logger using proxies and reflect

I've been playing around with AOP in JavaScript to create a Logger that I can attach to classes and output what is going on (mainly instantiation, calling of functions and the results from functions). ...
3
votes
0answers
62 views

Replicating Chrome console's JavaScript object explorer

This is a follow-up post of my previous question: Displaying JavaScript object's structure on page with HTML which looked at how to display all properties of a JavaScript object on a page similar to ...
3
votes
0answers
288 views

Scraping StackOverflow's questions with Node.js

I'm new to node and web scraping in general but with some research I've written this working code. My goal is to get all questions from X Stack Overflow's pages sorted by most rated and save that ...
3
votes
0answers
91 views

Simon game made with ECMAScript HTML and CSS

How does my HTML and CSS look? I'm a beginner so I have no idea if this is good design or not. Is there an easier way to copy and paste code here? Everytime I paste my code in here and use CTRL+K, ...
3
votes
0answers
58 views

Javascript clock/time increment improvement

I've create a time picker component and it works as it should. I've written it in vanilla js. I have learned js purely through writing jQuery and wanted to see if anyone would let me know how they ...
3
votes
0answers
100 views

Advent of Code 2017 Day 3 (part 1) in Functional Programming (FP)

I wanted to practice functional programming (FP) without using any library but using vanilla JS only. So I took a problem from Advent of Code. https://adventofcode.com/2017/day/3 You come across ...
3
votes
0answers
99 views

Truly private JavaScript class members (ES6)

I've found pretty simple and clear pattern which can be used to make any data members truly private (invisible, inaccessible) without affecting class behavior (no prototypes and ...
3
votes
0answers
80 views

Simple JavaScript MVC implementation

I'm learning to use MVC in my JavaScript apps and I thought it might be good practice to write my own MVC implementation. I'd like to know if you see any ways I could improve it or any potential ...
3
votes
0answers
276 views

Uploading series of large files to API via Node

I wrote a node script to traverse a folder of hour-long mp3s and upload them to Mixcloud via their API. It works, but I suspect it's fairly inefficient - the computer it's going to run on at our radio ...
3
votes
0answers
168 views

ECMAScript 6 amazon lambda image processing

I use this script in amazon lambda for image processing. Script should do: download image and watermark from amazon S3 resize image to two sizes put watermark on it and annotate with text put resized ...
3
votes
0answers
404 views

Linear finite state machine in ES6

I would love some feedback on my linear finite state machine. I say linear, as it can only handle one state at a time. I am also giving my method of how I -work- with the state machine, as I would ...
3
votes
0answers
60 views

Join arrays of objects by some identifier

The following is some JavaScript that I wrote to join two arrays of objects by an identifier. The goal is to extend the objects in a1 to include the extra fields in ...
3
votes
0answers
124 views

Tiny Image Editor

I made a small(ish) image editor for a client that is supposed to be able to do the following: initially scale image to preset size to avoid tiny/huge images initially center image in canvas resize ...
3
votes
0answers
127 views

jQuery form change listener, modularized using ES6

I have the following javascript code that I'm trying to modularize using ES6: ...
3
votes
0answers
38 views

A 'top 100' app that displays list of users ordered in two different ways

I built a small app that gets data from a remote json file and displays it in a list of users. In each list item, an image of the user, their name, and their points tallies are shown. The list is ...
2
votes
0answers
434 views

Determine whether there exists a one-to-one character mapping from one string to another

The task Determine whether there exists a one-to-one character mapping from one string s1 to another s2. For example, given s1 = abc and s2 = bcd, return true since we can map a to b, b to ...
2
votes
0answers
42 views

Simple table sorting using plain Javascript

This is a simple and clean script for sorting a specific column in a table. You could edit and parametrize it to add more customization, but I wanted to share the base concept. Base concept (I think ...
2
votes
0answers
134 views

ReactJS Typewriting animation

One of the dream idea to build typewriting in ReactJS. The code seems to be working, still there are something looks not that great in the code 😔 Looking for better solution (best practice) in the ...
2
votes
0answers
13 views

Combining immutable lists of strings with each other

The Problem Create a javascript method which combines each string of two immutable lists with each other: ...
2
votes
0answers
42 views

Simple npm module allowing users to create Sets of objects

I'm a junior developer and I've recently created a simple npm module that was designed to allow users to create Sets of objects in JavaScript. This was done by implementing a single class ...
2
votes
0answers
134 views

Advent of Code 2017 Day 6 (part 2) in Functional Programming (FP)

I wanted to practice functional programming (FP) without using any library but using vanilla JS only. So I took a problem from Advent of Code (the 2nd part of Day 6). You can only access the 2nd part ...
2
votes
0answers
73 views

Angular 1 CSS Encapsulation

I am trying to get a good clean way to do CSS Encapsulation in Angular JS. The main goal of this is to use isolated components. This is what I have come up with so far. The method I am using is ...
2
votes
0answers
43 views

Create exact replica of react component with different name

I have a react native component called "width". It has 3 width values which have associated <TextInput>s which map to the redux store as ...
2
votes
0answers
150 views

Personal resume and project site using React

Recently, I enrolled in the React Fundamentals course by Tyler McGinnis, and afterwards, I decided to rewrite my personal site to entirely run with ES6 React. Since I'm really new at this, I was ...
2
votes
0answers
110 views

Creating instances of a logger class for various logging levels

I provide a class to use but for convenience I want the class to implement some instance methods as static methods. This was fast and concise but it feels smelly, probably because I'm modifying the ...
2
votes
0answers
24 views

Tracking stopped players and connecting them so they can interact

This file handles the player "stopping" in space, trying to find whoever is ahead or behind (also stopped) and joining everyone into each others stopping -rooms. I'm not too sure about the whole "each ...
2
votes
0answers
538 views

Tic Tac Toe AI - library based on Minimax algorithm

I recently struggled with implementing AI in Tic Tac Toe game. For better understanding of minimax algorithm I've decided to separate AI's logic. When I finished I thought that some may find it useful,...
2
votes
0answers
138 views

Animation with JavaScript and Sass : Neon light banner

After reading a bit about CSS3-text-shadows and seeing a few advanced examples I had the idea for a "neon light"-banner. Next idea was to animate it. Finally it has become a mixture between a Sass-...
2
votes
0answers
430 views

Shortcode parser in Javascript

I've written a naive shortcode parser in JS that parses shortcodes akin to those found in Wordpress. The intention is for this to be used in realtime on the client in order to preview edits on the ...
2
votes
0answers
113 views

Simple native JS Calc

I've never been into web a lot, but I really want to. I started from simple things. I have some experience in .NET and c#. But the world of javascript is completely new for me. I wrote simple ...
2
votes
0answers
457 views

Min-Heap based priority queue class written in ES6

I would appreciate any feedback on syntax, naming convention, possible shortcuts, clarity of code and any other constructive feedback. This code was based off of the Priority Queue chapter in The ...
2
votes
0answers
243 views

Return the Euler Cycle for a graph with es6

My algorithm for finding an Euler tour of a digraph, G⃗, if such a tour exists, starting from some vertex, v. ...
2
votes
0answers
2k views

Flux & async communication with websockets

I want to arrange async server-client communication with websockets and vanilla flux architecture. There is an excellent article about "Async Server-Side Communication with the Flux Architecture". I ...
2
votes
2answers
158 views

Find out whether number is of Power of Two

The task is taken from leetcode Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: ...
1
vote
1answer
5 views

Extract string list as array from an array of objects

Having the following array of objects of ingredients used by cooks ...
1
vote
0answers
15 views

Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition

Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
1
vote
0answers
41 views

ES6 Class for getting GitHub PR info

I was learning some DOM manipulation and interaction with third-party APIs by building a simple interface to get the people who commented on a PR on GitHub. I got great feedback for my initial ...
1
vote
0answers
26 views

Promise-based AJAX calls base class

I am more than willing to use both a Promise library and an AJAX calls one if the situation calls for it. This base class sits at the very bare bones of my system and it needs to be done right. My ...
1
vote
0answers
56 views

Find the square root of n

The task: Given a real number n, find the square root of n. For example, given n = 9, return 3. My solution: ...
1
vote
0answers
17 views

JavaScript code for MAC registration micro webservice

The following code is part of the front-end of a micro webservice for users to allow them to register MAC addresses of their network devices and administrators to enable those and to generate a ...
1
vote
0answers
27 views

Selecting rows on condition in a table

I have a table with courses. The user that is currently logged in can mark these courses as attended and unattended. There can be multiple rows selected. The logic for this row selecting looks ...
1
vote
0answers
68 views

JavaScript time series data combination

I've written code that performs a merge of two streams of sorted time series data. The first stream is taken to be the primary and any successive streams are merged into it, using the nearest ...
1
vote
0answers
118 views

Creating a menu for a quiz

I've built a menu for a quiz, where everything is hard-coded apart from the categories, which I'm pulling from an API using Axios. Api.js ...
1
vote
0answers
36 views

Handling an array of Promises where we care about the outcome of each

Given some data (a job) like, which is from listening in on a RabbitMQ queue: ...
1
vote
0answers
629 views

React, Redux and SignalR connection dependent on global jQuery

I'm writing a react/redux application and I'm on a stage when I need to connect it with backend made with .net using a signalR socket connection. At the moment I've established interconnection ...
1
vote
0answers
154 views

React Bitcoin Exchange Single Page App

I've got a simple single page web app that's build with React. It fetches data from two different APIs, when they have been successfully retrieved, and the promise ...
1
vote
0answers
22 views

TemplateString class for re-usable template literals

I did a little preliminary research and was unable to find a class to create re-usable instances of template string literals, so I wrote my own. Below is the main file (slightly modified to remove ...