mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-09 12:52:20 +02:00
Initial pass
This commit is contained in:
commit
39c08a0eaa
7242 changed files with 1886006 additions and 0 deletions
33
node_modules/parse-json/index.js
generated
vendored
Normal file
33
node_modules/parse-json/index.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
const errorEx = require('error-ex');
|
||||
const fallback = require('json-parse-better-errors');
|
||||
|
||||
const JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s')
|
||||
});
|
||||
|
||||
module.exports = (input, reviver, filename) => {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(input, reviver);
|
||||
} catch (err) {
|
||||
fallback(input, reviver);
|
||||
|
||||
throw err;
|
||||
}
|
||||
} catch (err) {
|
||||
err.message = err.message.replace(/\n/g, '');
|
||||
|
||||
const jsonErr = new JSONError(err);
|
||||
if (filename) {
|
||||
jsonErr.fileName = filename;
|
||||
}
|
||||
|
||||
throw jsonErr;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue