#javascript #es6 #data structuresJavaScript remove duplicates, get unique/distinct values from Array with ES6+ Set and spreadWith ES6+, more developers should be leveraging built-ins than are using lodash functions. This post will go through how to remove duplicates ie. get distinct/unique values from an Array using ES6 Set. This gives you a one-line implementation of lodash/underscore’s uniq fu ...
#javascript #jest #node #es6 #testingJest Full and Partial Mock/Spy of CommonJS and ES6 Module ImportsJavaScript import/require module testing do’s and don’ts with Jest The example repository is available at github.com/HugoDF/mock-spy-module-import. This post goes through how to achieve different types of module mocking scenarios with Jest. From simple Import interce ...
#micro #node #javascript #es6 #architectureSimple, but not too simple: how using Zeit’s `micro` improves your Node applicationsLeave the Express comfort zone to expand how you think about Node application architecture. tl;dr using a function composition model for building HTTP servers is awesome Functions as a Service are great but have some drawbacks micro has a similar, simple API to FaaS but doesn&rs ...
#node #javascript #es6Use ES modules/ES6 import in Node without Babel/Webpack using `esm`Node has been implementing more and more ES6+ (ESNext) features natively. One of the features that is taking the longest to implement is modules. The reason for this is that Node and npm run on what is called CommonJS, with which you use require('module-name') to import from othe ...
#javascript #es6 #interview #functional programmingImpress interviewers with recursion in JavaScript with ES6 featuresThere’s nothing as flashy and useful for JavaScript interviews than recursion. If you just want to be impressive with recursion in JavaScript, here are some semi real-world (technical test type) examples. The short definition of a recursive solution to a problem (in computer sci ...
#node #javascript #es6Why you should wrap your (JavaScript) dependenciesAn email sending example. ...
#javascript #es6 #web developmentRecursion in JavaScript with ES6, destructuring and rest/spreadThe latest ECMA standard for JavaScript (ECMAScript 6) makes JavaScript more readable by encouraging a more declarative style with functional constructs and new operators. ...