Replace lodash with built-ins where possible to reduce bundle size (#1766)

* add tslint rule to disallow lodash.isUndefined

* add tslint rule to disallow lodash.isNull

* apply fixes
This commit is contained in:
Xianny
2019-04-10 09:36:32 -07:00
committed by GitHub
parent 49d951b7be
commit 7423028fea
299 changed files with 1249 additions and 1038 deletions

View File

@@ -1,4 +1,3 @@
import * as _ from 'lodash';
import * as React from 'react';
import styled from 'styled-components';
@@ -47,10 +46,10 @@ const Container = styled.div`
const Base = styled.div<CodeProps>`
font-size: 0.875rem;
color: ${props => (_.isUndefined(props.language) ? colors.white : 'inherit')};
color: ${props => (props.language === undefined ? colors.white : 'inherit')};
background-color: ${props =>
props.isLight ? 'rgba(255,255,255,.15)' : _.isUndefined(props.language) ? colors.black : '#F1F4F5'};
white-space: ${props => (_.isUndefined(props.language) ? 'nowrap' : '')};
props.isLight ? 'rgba(255,255,255,.15)' : props.language === undefined ? colors.black : '#F1F4F5'};
white-space: ${props => (props.language === undefined ? 'nowrap' : '')};
position: relative;
${props =>
@@ -143,7 +142,7 @@ class Code extends React.Component<CodeProps, CodeState> {
<Container>
<Base language={language} isDiff={isDiff} isLight={isLight}>
<StyledPre isDiff={isDiff}>
{_.isUndefined(hlCode) ? (
{hlCode === undefined ? (
<code>{children}</code>
) : (
<StyledCodeDiff