mirror of
https://codeberg.org/teddit/teddit.git
synced 2026-04-23 22:35:05 -04:00
initial commit
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
'use strict'
|
||||
|
||||
var tough = require('tough-cookie')
|
||||
|
||||
var Cookie = tough.Cookie
|
||||
var CookieJar = tough.CookieJar
|
||||
|
||||
exports.parse = function (str) {
|
||||
if (str && str.uri) {
|
||||
str = str.uri
|
||||
}
|
||||
if (typeof str !== 'string') {
|
||||
throw new Error('The cookie function only accepts STRING as param')
|
||||
}
|
||||
return Cookie.parse(str, {loose: true})
|
||||
}
|
||||
|
||||
exports.jar = function (store) {
|
||||
return new CookieJar(store, {looseMode: true})
|
||||
}
|
||||
Reference in New Issue
Block a user