shell-ahk
Version:
`Lodash`/`jQuery` for `AHK`.
23 lines (17 loc) • 585 B
text/coffeescript
# @ts-check
import $getType from './getType'
import $isArray from './isArray'
import $isNumber from './isNumber'
import $isString from './isString'
import $toString from './toString'
###* @type import('../type/module').Includes ###
export default (ipt, needle) ->
$type = $getType ipt
if ($isString ipt) or $isNumber ipt
unless $isString needle then return false
return (InStr ($toString ipt), needle) > 0
if $isArray ipt
for $it in ipt
if $it == needle then return true
return false
throw "$.includes: invalid type '#{$type}'"