UNPKG

@s-ui/js

Version:
48 lines 1.11 kB
import { parse as parseCookie } from 'cookie'; import jsCookie from 'js-cookie'; var parse = function parse(cookie) { return parseCookie(cookie); }; var get = function get(key) { return jsCookie.get(key); }; var getJSON = function getJSON(key) { return jsCookie.getJSON(key); }; var set = function set(key, val, options) { return jsCookie.set(key, val, options); }; var remove = function remove(key) { return jsCookie.remove(key); }; var cookie = { parse: parse, get: get, getJSON: getJSON, set: set, remove: remove }; var withoutEncoding = jsCookie.withConverter({ read: function read(value) { return value; }, write: function write(value) { return value; } }); var cookieWithoutEncoding = { get: function get(key) { return withoutEncoding.get(key); }, getJSON: function getJSON(key) { return withoutEncoding.getJSON(key); }, set: function set(key, val, opts) { return withoutEncoding.set(key, val, opts); }, remove: function remove(key) { return withoutEncoding.remove(key); } }; export default cookie; export { cookieWithoutEncoding };