have-empty-cell

v1.0.0arrow_drop_down
v1.0.0
v0.0.2
v0.0.1
STATUS
Passing
DOWNLOADS
234
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
537 B
check if 2d array have an empty cell
1 contributor
Install have-empty-cell as a package?
Copied
npm i @bit/joshk.tic-tac-toe-game.utils.have-empty-cell
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
No preview available
modifieddraft
No preview available
modifieddraft
No preview available
modifieddraft
chevron_left
chevron_right
utils/haveEmptyCell (
matrix,
rowsNum:number,
colsNum:number
) : boolean

check if 2d array have an empty cell

Examples
import haveEmptyCell from '@bit/joshk.tic-tac-toe-game.utils.have-empty-cell';

const matrix = [
         ['X', 'O', 'X'],
         ['O', 'X', 'O'],
         ['O', 'X', 'O']
     ];
const result = haveEmptyCell(matrix, 3, 3);

export default result
import haveEmptyCell from '@bit/joshk.tic-tac-toe-game.utils.have-empty-cell';

const matrix = [
         ['X', 'O', 'X'],
         ['O', '', 'O'],
         ['O', 'X', 'O']
     ];
const result = haveEmptyCell(matrix, 3, 3);

export default result
import haveEmptyCell from '@bit/joshk.tic-tac-toe-game.utils.have-empty-cell';

const matrix = [
         ['X', 'O', 'X'],
         ['O', , 'O'],
         ['O', 'X', 'O']
     ];
const result = haveEmptyCell(matrix, 3, 3);

export default result
import haveEmptyCell from '@bit/joshk.tic-tac-toe-game.utils.have-empty-cell';

const matrix = [
         ['X', 'O', 'X'],
         ['O', null, 'O'],
         ['O', 'X', 'O']
     ];
const result = haveEmptyCell(matrix, 3, 3);

export default result
Arguments
matrix

2d array

rowsNum: number

number of rows

colsNum: number

number of columns

Returns
boolean

return true if empty cell was found, and false if not.

Test Summary

haveEmptyCell cell function should return false

Pass

haveEmptyCell cell function should return true

Pass
Help and resources