Skip to content

Commit

Permalink
Add .code property to parse function TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
MaoShizhong committed May 3, 2024
1 parent 6abe0fc commit 2e660ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;

function parse(str, options) {
if (typeof str !== 'string') {
throw new TypeError('argument str must be a string');
var parseError = new TypeError('argument str must be a string')
parseError.code = 'ERR_INVALID_ARG_TYPE'
throw parseError
}

var obj = {}
Expand Down

0 comments on commit 2e660ac

Please sign in to comment.