Show Notes
In this Hasty Treat, Scott and Wes talk about handy utility functions with Just!
Sanity - SponsorSanity.ioΒ is a real-time headless CMS with a fully customizable Content Studio built in React. Get a Sanity powered site up and running in minutes atΒ sanity.io/create. Get an awesome supercharged free developer plan onΒ sanity.io/syntax.
LogRocket - SponsorLogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. Itβs an exception tracker, a session re-player and a performance monitor. Get 14 days free atΒ logrocket.com/syntax.
Show Notes03:44 - What is Just?
- https://github.com/angus-c/just
- No dependencies
- Itβs written in JS, so you can copy+paste them if you really need it
- Types available
- https://medium.com/@angustweets/just-a12d54221f65#.ljib0mfr5
06:46 - Some nice ones
- just-safe-set β deeply setting dynamic object properties
- set(data, 'a.long[0].path', value)
- object-typeof
- Why not useΒ typeof?
- Everything is an object
- Why not useΒ array.isArray?
- Handy to have a switch statement
- Why not useΒ typeof?
- just-*-case
- Camel, kebab, snake
- just-compare
10:54 - Why?
- This is the NPM install of Stack Overflow copy+paste
- Handy as hell
- Battle-tested
- Lots of ways to do simple stuff
- Sometimes the simple stuff has weird edge cases - these are caught
- Sometimes your checks can be messy
- Check if an object is empty
- 25 lines
- Just install it
12:05 - Other
- Great to learn and test yourself
- There are tests for each function
- Run them
- See them fail
- Try and make it so all the tests pass without looking at the source
- Scottβs Instagram
- LevelUpTutorials Instagram
- Wesβ Instagram
- Wesβ Twitter
- Wesβ Facebook
- Scottβs Twitter
- Make sure to includeΒ @SyntaxFMΒ in your tweets
