Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Typescript is a language which is a super set of JavaScript

3
votes
0answers
25 views

Angular directive to disable a button when clicked, allowing re-enabling as needed

I have written an Angular Directive that disables a button after it has been clicked, to prevent double posting / saving of data. This works fine in most of our use cases. However, in some situation ...
5
votes
4answers
47 views

Calculating total size of player data

I am writing a function to calculate the total size of a "player appearance". There are various "item slots" the player has, and if they are empty then 1 byte will be sent, otherwise there will be 2. ...
3
votes
0answers
36 views

Optimizing NICK binary thresholding

NICK binary thresholding essentially boils down to a convolution where the kernel at each pixel calculates the sum and squared sum (for the standard deviation). These values are then used in the ...
1
vote
0answers
34 views

Test for an array being subset of another master array

This is my first question in this forum. I was trying to build a small utility function to check if array is part of other array. Testing if an array is subset of another master array. ...
1
vote
0answers
43 views

Angular service for fetching and passing data with observables

I have an Angular service consisting of three methods: This method makes a call to my server to get a URL ...
0
votes
0answers
26 views

Asynchronous API handler function to update a game

I think mainly the GameController can use some optimization Game Entity.ts ...
1
vote
1answer
70 views

Checking whether an array contains a value or another array

I'm designing an isIn method that takes a value:any and checks whether it exists in an array. It's working, but I'm wondering ...
0
votes
0answers
28 views

I have three classes which all make API requests, how can I refactor their similar methods?

I'd first off like to apologize if this is the wrong place to post this question, but I figured that code review would be the most relevant place (compared to stackoverflow and softwareengineering). ...
0
votes
0answers
25 views

Checkboxes behave like radio buttons with angular

This is short Angular 5 code which works as intended: check boxes behave like radio buttons - only one can be selected at a time. Both versions of 'toggleCheckbox' works but I am interested is if ...
0
votes
2answers
57 views

JS code that search through every property in a nested object

I wrote code to search by keyword, and it will check all of the values from the object property, including an array in the object. But apparently the code is not optimized as it takes some time to ...
1
vote
0answers
23 views

Angular form data over multiple components

I have a form that I have broken into several different components in Angular. By the end of the form, all the data needs to be submitted together. My thought process was to create a provider to ...
1
vote
0answers
16 views

Firebase Plotter for Ionic

I've written this plotter for Ionic in Typescript to plot data that I push to a Firebase list. I'm new to Typescript so I'm interested in all kinds of feedback, especially on the style. First I've ...
7
votes
3answers
152 views

Find the fastest run of each year from a list of running results

Problem Explained: Imagine there is a list of running results of 1000m, like following: ...
3
votes
2answers
172 views

Creating nested objects from string

I implemented a method, to create an object based on a series of strings that are passed to it, of any depth or length. The way I implemented the solution was to map over the arguments. Assuming that ...
0
votes
0answers
26 views

An npm package to mirror/clone text areas without jQuery

I've been trying to get away from jQuery lately and needed to re-create a script I used for mirroring text inputs. npm i mirror-txt.js to include GitHub <...
0
votes
1answer
63 views

Promise-based fixed delay poller with timeout

I have the following functions for polling some function periodically with a timeout ...
5
votes
0answers
103 views

Factory method done on reactjs component,

A Factory Pattern or Factory Method Pattern says that just define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate. In other words, ...
2
votes
0answers
144 views

Robot on a Grid: Find a path between two corners with forbidden cells on the road

Problem statement The problem is defined in the book as following: 8.2 Robot in a Grid Imagine a robot sitting on the upper left corner of grid with r rows and <...
0
votes
0answers
70 views

ReactJS Component that retrieves quotes

I have created the following React Component and wanted to have feedback about if its SOLID or not, and what can I do to make it SOLID? I do believe its SOLID but would like feedback from guys with ...
0
votes
0answers
47 views

Parse big JSON for reactive form

I implements big reactive form on angular5. This form get data from JSON. I use formBuilder and several nested formGroups. Every field have default value before rendering form. In console output form ...
1
vote
0answers
38 views

Redux-like implementation in TypeScript

I need to write a custom reducer utility. It should take a dictionary of reducers and a publish subject to return a state, with a dispatch method to dispatch ...
1
vote
0answers
28 views

React Text Highlighter HOC in TypeScript

I'm shifting my focus towards frontend as much as I can, but I'm still quite unsure if I'm writing good code or not. Please take a look ...
0
votes
0answers
16 views

Jasmine tests for tax calculations in Angular 4

I am writing Jasmine tests in an Angular application and need to verify if I am testing correctly. If not, I would like suggestions in what area I should actually test. If you see in the code, ...
2
votes
1answer
45 views

Which will be better declaration go to with TypeScript? [closed]

This is a simple question, but during my migration to TypeScript, I'm seeing that in many cases my code could take these two directions... which one could be a better direction to go with: ...
0
votes
2answers
38 views

Picking a time based on when the app was last used

I am trying to set up a time variable as a local storage property to be retrieved when I open my app in my browser. If I open it for the first time, today, I'll set it up to today at midnight. ...
10
votes
1answer
95 views

Checkers Board Creator

A year or so ago, I wrote a checkers game for the Universal Windows Platform. Now, I wrote a web-based version of it hosted at http://checkerstreasury.azurewebsites.net. This is the first of a series ...
3
votes
0answers
27 views

The Beginnings of a HexCells Editor

This is my first foray into a full TypeScript program, and one I decided to do for fun and without the aid of jQuery. It is also my first time developing with the HTML canvas. That's quite a lot of ...
4
votes
1answer
66 views

Filtering objects according to required and preferred attributes

This my opportunity object which is a part of my angular app.component.ts file. In my template(HTML of this component) I want to ...
1
vote
3answers
48 views

Find deviations for a class in C# and present the values in a browser with TypeScript/JavaScript

We have a client that handles three different sort of licenses. These are up for renewal every year and upon renewal they need to check between 15-20 rules to see that everything is okay. They do this ...
5
votes
0answers
30 views

Macao, a General Game Playing AI library - Game state goes in, best move comes out

I'm working on a simple General Game Playing AI library. The idea is that it should work with almost any kind of game, with a minimum of configuration. At the moment, I have it working on 2 player ...
3
votes
1answer
62 views

Updating an offset in a buffer after each read

I'm having a bit of a debate at work regarding when to replace numeric literals with variable names. I have a function that reads data from a buffer and after each read, updates the offset so that ...
3
votes
1answer
109 views

Storing a fetched list of printers in Angular

I have a need to store data retrieved my ASP.NET Web Api to stop making redundant API calls for the same data when I navigate through my Angular page. On my API I have a database which stores a list ...
4
votes
1answer
57 views

Local weather app made with Typescript

I would like feedback on my Local weather app. This site simply gets the local weather. I refactored it from jQuery to Typescript to try to learn more about Typescript. Here is a demo: https://...
5
votes
1answer
110 views

State Monad in TypeScript

Here's my implementation of State Monad in TypeScript, based on a canonical Haskell implementation. I would like it to get code reviewed. ...
3
votes
1answer
69 views

Transforming data from an API using Typescript and Lodash

As a front-end developer, I am given the following result from an API, an array of objects that looks like: ...
3
votes
0answers
81 views

Filter properties and format values if they are currency

The function I've written in Typescript works great, but I'm not convinced that it's the cleanest and most efficient function. The function takes an object, omits properties found in an array, and ...
3
votes
0answers
34 views

Boilerplate-free mixin pattern for a TypeScript charting library

The TypeScript handbook provides a mixin pattern but it requires a bunch of boilerplate, doesn't work for getters/setters and doesn't support defining default values (or any constructor work) in the ...
2
votes
0answers
56 views

Space shooter game in TypeScript

I recently started learning TypeScript and created a small space shooter. I would like to get some feedback on the structure of my code. I have some classes with both static and instance methods with ...
6
votes
1answer
147 views

Iterating through nested array of objects

I have the following JSON list of objects, and I'm able to find the required object, and pass it back to the caller, given the id. Everything works fine, I'm just ...
1
vote
0answers
33 views

Fetching student and teacher data from a given date range

I have two APIs which fetch data of teachers and students from a given date range. I am using forkJoin to get both APIresponse and display the data with a regular interval of 10 ms. This is working ...
1
vote
1answer
38 views

Group orders with Ramda

I made some crude code using RamdaJS to essentially group orders by their states. There are some nested structures. Currently, I have a working code, but I wondering if Ramda can perhaps help to clean ...
2
votes
2answers
155 views

Extracting First, Last & Middle Name from a full name

My function takes a string of Name and returns First Name, Last Name and Middle Name as output. Please review and help me optimize it. ...
1
vote
1answer
76 views

Monkey-patching Jasmine's it() function to log errors

The introduction of async native support in Jasmine doesn't log the errors (i.e., specific line number where the error occurs) to the console. So, to get around this behavior and to make the errors ...
3
votes
0answers
84 views

Build dynamic HTTP service with Angular

I have an Ionic application, this application contains set of pages and services. Since I'm working with Ionic and Angular I decided to build reusable code for different projects, for example: HTTP ...
3
votes
0answers
163 views

Blocking Promise-driven queues with ECMAScript's async/await and generators

I implemented an AsyncQueue, whose dequeue() operation returns a Promise. The ...
1
vote
0answers
27 views

Class to handle complex form using Angular ReactiveForms

I'm working with the ReactiveForms in Angular5 and trying to find a good way to do this. So, in my use case, I have a FormGroup inside my example.component.ts and when I need to add some FormControl ...
1
vote
0answers
32 views

Angular - Using Observables and subscribing to its changes [closed]

I have a component and a service. The service is contacting an API and gets a data which should be handled in the component. Now, I can do it in two ways: Create a public ...
-1
votes
1answer
100 views

Javascript RabbitMQ -> Pull Single Message [closed]

I'm trying to pull a single message off of rabbitmq, process it, and acknowledge that single message. I don't want it to continue after acknowledgement pulling messages off the queue. If I don't do ch....
1
vote
1answer
64 views

Using Vue to help form validation with weight for age

I am refactoring a very old web page which calculates bolus and infusion drug doses for children from premature through to young adulthood. One of the most common drug errors is accidental 10 fold ...
1
vote
2answers
124 views

Generator function to enumerate files

I want to implement a function that enumerates all files in directory. I think the function should Return a Promise, because underlying readdir call is prefered ...