component should be independent of the DOM structure #javascript component-driven architecture
#javascript #fill [0,1,2,3].fill(5); // [5,5,5,5] [0,1,2,3].fill(5, start=2); // [0,1,5,5] [0,1,2,3].fill(5, start=2, end=3); // [0,1,5,3]
let curry = a => b => c => a + b + c; curry(9)(7)(5); // 21 #javascript #ES2015 #currying
not all programming languages can do this var double = function(a) { return a * 2; }; deal with it #javascript #functions are values
1
Inheritance is when you design your types around what they are. Composition is when you design your types around what they do. #javascript
I remember when var f = function (obj) { return { obj: obj }; } now let f = (obj) => ({obj}); #javascript #ES6
factory functions are functions that creates objects and return them #javascript #factoryfunctions #dontuseclassesplease
1
Аневризма retweeted
A Jasmine custom matcher is just a method that returns an object that has a compare method that returns an object that has a “pass” property
3
4
3
Аневризма retweeted
Understanding Transducers in JavaScript medium.com/@roman01la/unders…
8
15
#javascript #ES6 #setPrototypeOf Object.setPrototypeOf – changes prototype. Equivalent to Object.prototype.__proto__ setter
the 'default' export is just another named export. import { default as foo } from 'lib'; import foo from 'lib'; #javascript #ES6 #modules
1
#javascript #es6 deep array #destructuring let [a, [b, [c, d]]] = [1, [2, [[[3, 4], 5], 6]]]; #es2015
Аневризма retweeted
RT @allsecretcoding Best Angular resources voted by community. 'Most Saved'🏆 @angularjs ... lnkplg.co/pZrEJ
8
8
@blackendjero it('async', () => { deferred.promise.then(n => { expect(n).toBe(4); }); deferred.resolve(6); $rootScope.$digest(); });
let deferred, $rootScope; beforeEach(()=>{ inject($q, _$rootScope_){ deferred = $q.defer(); $rootScope = _$rootScope_; }); }); #unittest
$provide.value('Service', { get: () => { return {then: callback => callback({o: 8})}; } }); #angularjs #unittesting #mocking #promises
1
Again... "no component should be allowed to mutate any data that is doesn't own" @teropa changed my life, I'll stick with it #javascript
2
1
A function that returns a function that has a default parameter a function is one of the best things I love and learned from #javascript
Аневризма retweeted
Apple, Microsoft and Samsung must stop sourcing materials mined by child laborers tnw.me/eIydvT8 https://nitter.catsarch.com/t.co/dpes32DmXT
1
18
12