(option?: Options)
| 25 | } |
| 26 | |
| 27 | export const create = (option?: Options): ValueGuide => { |
| 28 | if (isDefined(option)) { |
| 29 | if (isDefined(option?.snap)) { |
| 30 | return ValueGuide.snap( |
| 31 | option?.trackLength, option?.snap?.snapLength, Array.isArray(option?.snap?.threshold) |
| 32 | ? option?.snap.threshold |
| 33 | : [option?.snap?.threshold]) |
| 34 | } else { |
| 35 | return ValueGuide.identity(option?.trackLength) |
| 36 | } |
| 37 | } else { |
| 38 | return ValueGuide.identity() |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | export const snap = ( |
| 43 | trackLength: number = DEFAULT_TRACK_LENGTH, |