LODASH FOR PRESIDENT Christian Ulbrich, CDO Zalari UG

AGENDA PROPAGANDA •

Recap: LoDash



Why?



Installation



Examples galore



Links

RECAP - LODASH

„Who has never heard of LoDash?“

RECAP - LODASH •

available on npm and bower



generic JavaScript library, thus works in backend and frontend



either load it via script tag or with a module loader of your choice



custom builds, bundles are available

WHY LODASH

„Look, I invented something…“

WHY LODASH THE WIEL!

WHY LODASH

WHY LODASH •

Human make errors and we don’t like to repeat ourselves over and over again



working with declarative code enables less errors and fosters maintainability



-> „human JavaScript“

INSTALLATION

EXAMPLES COLLECTIONS •

LoDash has enhanced Shortcuts for typical array functions, like _.forEach, _.map, _.reduce, _.filter



they used to be performance optimized



they also work on Collections (Arrays + abused Objects)

FILTERING + FINDING •

_.filter returns Elements that the passed predicate is true



_.find returns the first Element that the passed predicate is true



brethren: _.reject, _.findLast, _.some, _.without

FILTERING + FINDING •

there are some nice built-in predicate function producing functions:



_.matches, _.matchesProperty, _.property



lodash analyzes the signature of the passed argument to most of its collection functions and calls them appropriately

FILTERING + FINDING

FILTERING + FINDING •

What about combining individual functions and rules?



How can we figure out only the names of all the presenters that obey the rule famePredicate?

LODASH CHAINING •

LoDash allows for chaining of its functions via _.chain wrapper, then the value of each call is passed along the chain



at the end of the chain, we can access the value with .values()

LODASH CHAINING

UTILITY FUNCTIONS •

Object manipulation: _.merge, _.clone, _.cloneDeep •

beware of different LoDash versions



_.merge modifies the first parameter!

UTILITY FUNCTIONS •

_.parseInt(numbery)



_.snakeCases, _.startCase, _.pad



_.inRange,

_.random

UTILITY FUNCTIONS •

_.isUndefined



_.isNumber



_.isType (Array, Date, Buffer, Integer, Object, …)

UTILITY FUNCTIONS

UTILITY FUNCTIONS

ARRAY GOODNESS



_.zip



_.flatten, _.flattenDeep, _.join, _.pull, _.pullAll, …

COLLECTION GOODNESS



_.sortBy, _.flatMap, _.shuffle, _.groupBy



_.flatten, _.flattenDeep, _.join, _.pull, _.pullAll, …

HUMAN JAVASCRIPT •

META!



whenever maintainability is more important than performance, you should write human JavaScript



LoDash’ expressive and clever naming of functions allow to do that easily

HUMAN JAVASCRIPT •

simple StateMachine, has valid state transitions



a declarative approach lets the code speak



find returns undefined if nothing is found

HUMAN JAVASCRIPT •

crude indexOf syntax with bit operators versus declarative _.includes

LINKS •

Human JavaScript http://read.humanjavascript.com/



LoDash et al. http://lodash.com



10 Javascript Utility Functions That You Should… http://bit.ly/1IHH5Ba

BONUS



http://lodash.com and your web console are a poor man’s playground for testing LoDash funtions… because LoDash loads itself!

Lodash for President - GitHub

Page 1. LODASH FOR PRESIDENT. Christian Ulbrich, CDO Zalari UG. Page 2. AGENDA PROPAGANDA. • Recap: LoDash. • Why? • Installation.

1MB Sizes 4 Downloads 320 Views

Recommend Documents

President Jean-Claude Junker President of the ... -
independent journalists and human rights defenders to not publish reports related to the Beni massacre or any picture revealing the situation connected to these atrocities, and many activists who makes government critics have either been convicted or

Page 1 December 2009 Officers President Vice-President Treasurer ...
restored train station, was well attended and very ... 7000 rail cars of coal per week were being shipped ... National Trail, known to Indians, Pioneers and.

Uses for Modules - GitHub
In this article, I will walk you through several practical examples of what modules can be used for, ranging from ... that is not the case. Ruby would apply the definitions of Document one after the other, with whatever file was required last taking

For Developing Countries - GitHub
Adhere to perceived affordance of a mobile phone to avoid alienating the user. Target users are unfamiliar to banking terminology. Balance Check. Shows current balance in m-banking account. Top Up. Scratch card or merchant credit transfer. Credit Tra

From Your President - Sites
A few people need to be thanked for making this conference a ... an ISMTA conference is the ability to hear the amazing playing of ...... illustration. Since visual ...

Clojure for Beginners - GitHub
Preview. Language. Overview. Clojure Basics & .... (clojure.java.io/reader file))]. (doseq [line .... Incremental development via REPL ⇒ less unexpected surprises ...

hacking for sustainability - GitHub
web, is the collection of interconnected hypertext3 documents. 3 Hypertext is a .... the online photo service Flickr hosts now more than 200 ... It is one of the top ten most visited websites ..... best possible delivery route between different store

Directions For Use - GitHub
Page 7 of 46. 4. Using EMPOP to perform mtDNA haplotype frequency estimates. EMPOP follows the revised and extended guidelines for mitochondrial DNA typing issued by the DNA commission of the ISFG (Parson et al. 2014). See document for further detail

Haskell for LATEX2e - GitHub
School of Computer Science and Engineering. University of New South Wales, Australia [email protected]. .... Research report, Yale University, April 1997. 4.

Manual for tsRFinder - GitHub
Feb 11, 2015 - Book (running OS X) or laptop (running Linux), typically within 10 min- .... ure (”label/distribution.pdf”) showing the length distributions and base.

Paul Mustone President Brian Grosse Vice President ... - PDFKUL.COM
Brian Grosse. Vice President. Specification/Project. Ian Coll. Specification Sales. Jessica Mustone. Specification Sales. Kelly Carls. Specification Sales. Bianca Leonard. Specification Sales. Morgan McGowan. Specification Support. Terry Jewell. Spec

Paul Mustone President Brian Grosse Vice President ... -
Dave Fitzpatrick. Quotations. Team Leader. Mike Doyle. Quotations. Brianna Cosgrove. Quotations. Josh Luther. Quotations. Patty Reed. Project Management. Peg Costagliola. Project Management. Mina Tandun. Project Managment. Donna Caldarola. Project Ma

Notes for GTM 9 - GitHub
Aug 6, 2013 - the eigenvalues of adx are precisely the n2 scalars ai − aj(1 ⩽ i, j ⩽ n), which of course need not be distinct. Solution. Choose a basis for Fn so ...

Commands for EV3-API - GitHub
char. Color of text. 1: black text. 0: wihteteext with black background. .... LED color cannot be changed while warning is set. ... (1: true, 0: false).

Font Display for Career - GitHub
Font Display for Career. 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. A. B. C. D. E. F. 0020 ! " # $. & ' ( ). + , - . /. 0030 0 1 2 3 4 5 6 7 8 9 : ; < = > ? 0040 @ ...

Manual for pasdoc 0.8 - GitHub
Jul 12, 1997 - @author Treat the argument as an author's name and email address .... HTML file by using htlatex, or a PDF file by using pdflatex. It is to note ...

Speech recognizer for EllaVator - GitHub
Jun 3, 2015 - Page 1 .... = [ Take me to ] | [please ];. = ( first ... Dont forget to pre-process the data before using the online tool (web interface).

Tutorial for Overture/VDM++ - GitHub
Sep 6, 2015 - Overture Technical Report Series. No. TR-004. September ... Year Version Version of Overture.exe. January. 2010. 0.1.5 ... Contents. 3 Overture Tool Support for VDM++. 1. 3.1 Introduction . .... classes and their usage in class diagrams

dear mr. president Services
We are pleased to stand together and voice our support for the concept of a STEM ..... of accomplished teachers, say elementary specialists in science with high school science teachers, and this will allow them .... these opportunities as a reward wh