Skip to content

Instantly share code, notes, and snippets.

@nrkn
Created June 26, 2019 22:11
Show Gist options
  • Save nrkn/1a5a75d6e93009b965a58982cd2fed27 to your computer and use it in GitHub Desktop.
Save nrkn/1a5a75d6e93009b965a58982cd2fed27 to your computer and use it in GitHub Desktop.
export const createPoint = ( x, y ) => ({ x, y })
export const isPoint = value =>
value && typeof value.x === 'number' && typeof value.y === 'number'
export const translatePoint = ( { x: x0, y: y0 }, { x: x1, y: y1 } ) =>
createPoint( x0 + x1, y0 + y1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment