Skip to content

Commit

Permalink
clean up formatting and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 9, 2022
1 parent 4b9c1b5 commit e962140
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/getGameLevelsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ function getGameLevelsSchema( numberOfLevels: number ) {
return {
public: true,
type: 'array',

// each level number in the array
elementSchema: {
type: 'number',

// validation for each level number in the array
isValidValue: ( value: number ) => ( Number.isInteger( value ) && value > 0 && value <= numberOfLevels )
},
defaultValue: Array.from( { length: numberOfLevels }, ( _, i ) => i + 1 ), // [ 1, 2,...,numberOfLevels]

// [ 1, 2,...,numberOfLevels]
defaultValue: Array.from( { length: numberOfLevels }, ( _, i ) => i + 1 ),

// validation for the array as a whole
isValidValue: ( array: number[] ) => {
Expand Down

0 comments on commit e962140

Please sign in to comment.