Skip to content

jamesplease/within-periodic-hole.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

within-periodic-hole.js

Travis build status Code Climate Test Coverage Dependency Status devDependency Status

Determine if a point is inside of a periodic hole.

Terminology

A hole is a piece of a function that does not exist. Consider the following function:

0 1 2 _ _ _ 6 7 8 _ _ _ 12 13 14

This is a function with a hole of length 3 and period 3.

A periodic hole is defined by three properties:

  • length - The length of the hole
  • period - How often the hole repeats itself
  • startValue - A value that marks the (inclusive) start of a hole

To define the hole in the above example, the following definition would be used:

{
  length: 3,
  period: 3,
  startValue: 3
}

API

withinPeriodicHole(point, holeDefinition)

Returns a Boolean indicating whether the point is in the periodic hole defined by holeDefinition.