UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 544 B
import{Buffer as e}from"node:buffer";function isPromiseLike(e){if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;try{return typeof e.then==`function`}catch{return!1}}function isContinuationByte(e){return e!==void 0&&(e&192)==128}function truncateUtf8Suffix(t,n){if(n<=0)return``;if(t.length<=n&&e.byteLength(t)<=n)return t;let r=e.from(Number.isInteger(n)?t.slice(-n-1):t),i=r.byteLength-n;for(;i<r.byteLength&&isContinuationByte(r[i]);)i+=1;return r.subarray(i).toString(`utf8`)}export{isPromiseLike as n,truncateUtf8Suffix as t};