Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Writer.prototype.writeString = function (s, tag) {
if (typeof (s) !== 'string')
throw new TypeError('argument must be a string (was: ' + typeof (s) + ')');
if (typeof (tag) !== 'number')
tag = ASN1.OctetString;
var len = Buffer.byteLength(s);
this.writeByte(tag);
this.writeLength(len);
if (len) {
this._ensure(len);
this._buf.write(s, this._offset);
this._offset += len;
}
};