@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 846 B
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../assert/is-integer.js";import e from"./../assert/is-string.js";var t=r.isPrimitive,i=e.isPrimitive;function n(r,e,n){var a,u;if(!i(r))throw new TypeError("invalid argument. First argument must be a string primitive. Value: `"+r+"`.");if(!i(e))throw new TypeError("invalid argument. Second argument must be a string primitive. Value: `"+e+"`.");if(arguments.length>2){if(!t(n))throw new TypeError("invalid argument. Third argument must be an integer. Value: `"+n+"`.");if(0===n)return 0===e.length;a=n<0?r.length+n:n}else a=r.length;if(0===e.length)return!0;if((a-=e.length)<0)return!1;for(u=0;u<e.length;u++)if(r.charCodeAt(a+u)!==e.charCodeAt(u))return!1;return!0}var a=n;export default a;
//# sourceMappingURL=ends-with.js.map