Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refactor usage of noop and is utils
  • Loading branch information
Jon Q committed Jan 20, 2021
commit fa706a814f81b0e3e78a51949e95cb6b760e22ab
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { __ } from '@wordpress/i18n';
/**
* External dependencies
*/
import { noop } from 'lodash';
import { contextConnect, useContextSystem } from '@wp-g2/context';
import { noop } from '@wp-g2/utils';
import {
Grid,
TextInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* External dependencies
*/
import { noop } from '@wp-g2/utils';
import { noop } from 'lodash';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* External dependencies
*/
import { ui } from '@wp-g2/styles';
import { createUnitValue, is, parseUnitValue } from '@wp-g2/utils';
import { createUnitValue, parseUnitValue } from '@wp-g2/utils';

const DEFAULT_FONT_SIZE = 'default';
const CUSTOM_FONT_SIZE = 'custom';
Expand Down Expand Up @@ -55,9 +56,10 @@ export function getSelectOptions( {
}

return options.map( ( option ) => {
const fontSize = is.number( option.size )
? createUnitValue( option.size, 'px' )
: option.size;
const fontSize =
typeof option.size === 'number'
? createUnitValue( option.size, 'px' )
: option.size;

return {
...option,
Expand All @@ -80,7 +82,8 @@ export function getInputValue( fontSizes = [], value ) {
}

const isPixelValue =
is.number( value ) || ( is.string( value ) && value.endsWith( 'px' ) );
typeof value === 'number' ||
( typeof value === 'string' && value.endsWith( 'px' ) );

const inputValue = ( isPixelValue && noUnitsValue ) || '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* External dependencies
*/
Expand Down