Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PostmanCookieStore.prototype[method] = function () {
var eventName = EXECUTION_EVENT_BASE + this.id,
args,
eventId,
callback;
// fetch all the arguments passed to the method
args = arrayProtoSlice.call(arguments);
// adjust arguments length based on Store's prototype method
// eslint-disable-next-line lodash/path-style
args.length = _.get(Store.prototype, [method, 'length'], 0);
// move callback/last argument out of arguments
// this will be called when timer clears the event
callback = args.pop();
// set event for the callback
eventId = this.timers.setEvent(function (err, cookies) {
if (typeof callback !== FUNCTION) {
throw new TypeError('callback is not a function');
}
// methods: putCookie, updateCookie, removeCookie, removeCookies,
// removeAllCookies
// or, onError
if (err || !cookies) {
return callback(err);