- Prefer the usage of native methods, don't rely too much on lodash.
Examples:
- We tend to over use isEmpty and there're many native ways to do it:
import { isEmpty } from "lodash-es"; /* When an array is present or does not have values */
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the z-index value of the element. | |
* | |
* | |
* @param element - The html element. | |
* @returns the element zIndex. | |
* | |
*/ | |
const getZIndex = (element) => getComputedStyle(element).zIndex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import PropTypes from "prop-types"; | |
import { isEmpty, isUndefined } from "lodash-es"; | |
import { makeCurrentLevel } from "redux-modules/location/hierarchy"; | |
const LevelOption = props => { | |
const { level } = props; | |
if (!isEmpty(level)) { | |
const { id, attributes } = level; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: starefossen/ruby-node:2-5 | |
pipelines: | |
branches: | |
master: | |
- step: | |
script: | |
- export HEROKU_APP_NAME=ci-conceptual | |
- chmod +x deploy-scripts/package_and_deploy.sh deploy-scripts/migrate.sh deploy-scripts/restart.sh | |
- deploy-scripts/package_and_deploy.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if object.errors.any? %> | |
<div class="alert alert-danger alert-dismissible fade show" id="error_explanation" role="alert"> | |
<h4> | |
<%= pluralize(object.errors.count, "error") %> | |
prohibited | |
this object from being saved: | |
</h4> | |
<ul> | |
<% object.errors.full_messages.each do |msg| %> | |
<li> |