Skip to content

Commit

Permalink
Revert move isObject to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed May 27, 2024
1 parent afb5f80 commit 4309428
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/interactivity/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
setNamespace,
resetNamespace,
} from './hooks';
import { isObject } from './utils';
const isObject = ( item: unknown ): item is Record< string, unknown > =>
Boolean( item && typeof item === 'object' && item.constructor === Object );

const deepMerge = ( target: any, source: any ) => {
if ( isObject( target ) && isObject( source ) ) {
Expand Down
3 changes: 0 additions & 3 deletions packages/interactivity/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,3 @@ export const warn = ( message: string ): void => {
logged.add( message );
}
};

export const isObject = ( item: unknown ): item is Record< string, unknown > =>
Boolean( item && typeof item === 'object' && item.constructor === Object );
4 changes: 3 additions & 1 deletion packages/interactivity/src/vdom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import { h, type ComponentChild, type JSX } from 'preact';
* Internal dependencies
*/
import { directivePrefix as p } from './constants';
import { warn, isObject } from './utils';
import { warn } from './utils';

const ignoreAttr = `data-${ p }-ignore`;
const islandAttr = `data-${ p }-interactive`;
const fullPrefix = `data-${ p }-`;
const namespaces: Array< string | null > = [];
const currentNamespace = () => namespaces[ namespaces.length - 1 ] ?? null;
const isObject = ( item: unknown ): item is Record< string, unknown > =>
Boolean( item && typeof item === 'object' && item.constructor === Object );

// Regular expression for directive parsing.
const directiveParser = new RegExp(
Expand Down

0 comments on commit 4309428

Please sign in to comment.