Skip to content

Commit

Permalink
Parser: Fix small code style per review
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 15, 2017
1 parent a6ffcaa commit 032ddc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 3 additions & 7 deletions blocks/api/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { parse as hpqParse } from 'hpq';
import { keys, mapValues } from 'lodash';
import { mapValues } from 'lodash';

/**
* Internal dependencies
Expand Down Expand Up @@ -73,11 +73,7 @@ export function matcherFromSource( sourceConfig ) {
case 'node':
return node( sourceConfig.selector );
case 'query':
const subMatchers = keys( sourceConfig.query ).reduce( ( memo, key ) => {
memo[ key ] = matcherFromSource( sourceConfig.query[ key ] );
return memo;
}, {} );

const subMatchers = mapValues( sourceConfig.query, matcherFromSource );
return query( sourceConfig.selector, subMatchers );
default:
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -131,7 +127,7 @@ export function getBlockAttributes( blockType, innerHTML, attributes ) {
} );

// If the block supports a custom className parse it
if ( false !== blockType.className && attributes && attributes.className ) {
if ( blockType.className !== false && attributes && attributes.className ) {
blockAttributes.className = attributes.className;
}

Expand Down
3 changes: 2 additions & 1 deletion blocks/api/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export function getCommentAttributes( allAttributes, blockType ) {
return result;
}

// Ignore values sources from content and post meta
// Ignore all attributes but the ones with an "undefined" source
// "undefined" source refers to attributes saved in the block comment
if ( attributeSchema.source !== undefined ) {
return result;
}
Expand Down

0 comments on commit 032ddc4

Please sign in to comment.