UNPKG

@superawesome/permissions

Version:

Fine grained permissions / access control with ownerships & attribute picking, done right.

40 lines 1.34 kB
"use strict"; /** Copied from https://stackoverflow.com/a/13842010/799502 / https://github.com/PimpTrizkit/PJs/wiki/11.-Object-to-String-(pOTS.js) * Should be replaced with util.inspect, as long as it is parsable by prettier * */ Object.defineProperty(exports, "__esModule", { value: true }); exports.pOTS = void 0; /* eslint-disable */ exports.pOTS = (o) => { if (!o) return null; let str = '', na = 0, k, p; if (typeof o === 'function') return o.toString(); if (typeof o == 'object') { if (!exports.pOTS.check) exports.pOTS.check = new Array(); for (k = exports.pOTS.check.length; na < k; na++) if (exports.pOTS.check[na] == o) return '({})'; exports.pOTS.check.push(o); } (k = ''), (na = typeof o.length == 'undefined' ? 1 : 0); for (p in o) { if (na) k = "'" + p + "':"; if (typeof o[p] == 'string') str += k + "'" + o[p] + "',"; else if (typeof o[p] == 'object') str += k + exports.pOTS(o[p]) + ','; else str += k + o[p] + ','; } if (typeof o == 'object') exports.pOTS.check.pop(); if (na) return '({' + str.slice(0, -1) + '})'; else return '[' + str.slice(0, -1) + ']'; }; //# sourceMappingURL=pOTS.js.map