import { ensureArray } from "@thi.ng/arrays/ensure-array" ; import { isArray } from "@thi.ng/checks/is-array" ; import { isString } from "@thi.ng/checks/is-string" ; import { concat } from "./concat.js" ; import { reverse } from "./reverse.js" ; import { str } from "./str.js" ; remarks example param x export function palindrome ( x ) ; export function palindrome < T > ( x ) ; export function palindrome < T > ( x ) ; export function palindrome ( x ) { return isString ( x ) ? str ( "" , concat ( [ x ] , reverse ( x ) ) ) : isArray ( x ) ? x . concat ( x . slice ( ) . reverse ( ) ) : ( ( x = ensureArray ( x ) ) , concat ( x , reverse ( x ) ) ) ; }