Skip to content

Module #3(Mahdi)#37

Open
MahdiMurshed wants to merge 11 commits intorecruit-org:module-2from
MahdiMurshed:module-3
Open

Module #3(Mahdi)#37
MahdiMurshed wants to merge 11 commits intorecruit-org:module-2from
MahdiMurshed:module-3

Conversation

@MahdiMurshed
Copy link
Copy Markdown

No description provided.

({ x, y, type }) =>
object.some((obj) => obj.type === type && obj.x === x && obj.y === y),
[object]
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isObject function can be reused

const isTypeObject = useCallback(
    ({ x, y, type }) =>{
         const object = isObject(x, y);
         return object && object.type === type;
    },
    [object]
  );

({ x, y }) => object.some((obj) => obj.x === x && obj.y === y),
[object]
);
const isTypeObject = useCallback(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my opinion, isCellContainsObjectOfType describes the job better right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  const isObject = useCallback(
    ({ x, y }) => object.find((obj) => obj.x === x && obj.y === y),
    [object]
  );
  const isCellContainsObjectOfType = useCallback(
    ({ x, y, type }) => {
      const _obj = isObject({ x, y });
      return _obj && _obj.type === type;
    },
    [isObject]
  );

@royantar0311

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MahdiMurshed seems perfect.
isCellContainsObjectOfType should be doesCellContainObjectOfType, my bad english -_-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants