Skip to main content
added 53 characters in body
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

JavaScript (ES6), 8484 81 bytes

s=>(new Set(st=[...s]).size>2)*(![...s]t.some((c,i)=>c>s[i+1])-![...s]t.some((c,i)=>c<s[i+1])) 

Assumes the input is all in the same case. Returns 1 for raising wavy, -1 for decreasing wavy, 0 or -0 (both are falsy) for not wavy. Edit: Saved 3 bytes thanks to @RobertHickman.

JavaScript (ES6), 84 bytes

s=>(new Set(s).size>2)*(![...s].some((c,i)=>c>s[i+1])-![...s].some((c,i)=>c<s[i+1])) 

Assumes the input is all in the same case. Returns 1 for raising wavy, -1 for decreasing wavy, 0 or -0 (both are falsy) for not wavy.

JavaScript (ES6), 84 81 bytes

s=>(new Set(t=[...s]).size>2)*(!t.some((c,i)=>c>s[i+1])-!t.some((c,i)=>c<s[i+1])) 

Assumes the input is all in the same case. Returns 1 for raising wavy, -1 for decreasing wavy, 0 or -0 (both are falsy) for not wavy. Edit: Saved 3 bytes thanks to @RobertHickman.

Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

JavaScript (ES6), 84 bytes

s=>(new Set(s).size>2)*(![...s].some((c,i)=>c>s[i+1])-![...s].some((c,i)=>c<s[i+1])) 

Assumes the input is all in the same case. Returns 1 for raising wavy, -1 for decreasing wavy, 0 or -0 (both are falsy) for not wavy.