feat: request snippets plugin (#6910)

This commit is contained in:
Mahtis Michel
2021-03-10 20:02:34 +01:00
committed by GitHub
parent 15b8c0c929
commit 8405fa0101
18 changed files with 537 additions and 210 deletions

View File

@@ -32,25 +32,6 @@ const DEFAULT_RESPONSE_KEY = "default"
export const isImmutable = (maybe) => Im.Iterable.isIterable(maybe)
export function isJSONObject (str) {
try {
var o = JSON.parse(str)
// Handle non-exception-throwing cases:
// Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
// but... JSON.parse(null) returns null, and typeof null === "object",
// so we must check for that, too. Thankfully, null is falsey, so this suffices:
if (o && typeof o === "object") {
return o
}
}
catch (e) {
// do nothing
}
return false
}
export function objectify (thing) {
if(!isObject(thing))
return {}