import { illegalArgs } from "@thi.ng/errors/illegal-arguments" ; param src param insert param from param to export const splice = ( src , insert , from , to = from ) => { if ( from < 0 ) { from += src . length ; } if ( to < 0 ) { to += src . length ; } if ( from > to ) { illegalArgs ( "'from' index must be <= 'to'" ) ; } to = Math . max ( to , 0 ) ; return from <= 0 ? insert + src . substr ( to ) : from >= src . length ? src + insert : src . substr ( 0 , from ) + insert + src . substr ( to ) ; } ;