Existem 3 entradas possiveis
truefalseundefined
as saídas serão:
undefinded=>true
| const parseResponse = ({ data }) => { | |
| if (data.error === true) { | |
| return Promise.reject(data) | |
| } | |
| return data | |
| } | |
| const http = axios.create({ }) |
| import { deburr, sortBy } from 'lodash' | |
| const sanitizeAndLower = value => deburr(value).toLowerCase() | |
| // | |
| const sortByString = (list, key) => sortBy(list, x => sanitizeAndLower(x[key])) | |
| const sortByName = list => sortByString(list, 'name') |
| xinput list --short | grep Logitech | awk '{print $5}' | cut -f2 -d"=" | xargs -I id xinput set-prop id "Device Accel Constant Deceleration" 0.4 |
| export default Vue => { | |
| Vue.mixin({ | |
| created () { | |
| const { title } = this.$options | |
| if (title !== undefined) { | |
| this.$title = title | |
| } | |
| } | |
| }) |
| import { identity } from 'lodash' | |
| import waith from './waith' | |
| export default (action, repetitions, timeToWaith = 3000) => { | |
| const onError = counter => () => { | |
| if (counter < repetitions) { | |
| return run(counter + 1) | |
| } | |
| return Promise.reject(new Error('TRIES_FAILURE')) |
Em JavaScript há uma comportamento chamado hoisting.
O uso de var trazia algumas pegadinhas, como por exemplo, declarar a mesma variavel 2x usando var
var abc = 25
// ...
// ...
var abc = 99(Descrição completa e mais comandos aqui - https://npmjs.org/doc/index.html)
npm install <module-name> --save
| # Versions | |
| # Where the ambientum cache will live | |
| A_CACHE_HOME=$HOME/.cache/ambientum | |
| # Define specific cache directories | |
| A_NPM_CONFIG=$A_CACHE_HOME/npm-config | |
| A_NPM_CACHE=$A_CACHE_HOME/npm-cache | |
| A_COMPOSER_CACHE=$A_CACHE_HOME/composer |