UNPKG

angular-l10n

Version:

An Angular library to translate messages, dates and numbers

67 lines 1.65 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ /** * @param {?} name * @return {?} */ export function getLocalStorage(name) { return localStorage.getItem(name); } /** * @param {?} name * @return {?} */ export function getSessionStorage(name) { return sessionStorage.getItem(name); } /** * @param {?} name * @return {?} */ export function getCookie(name) { /** @type {?} */ var result = null; if (typeof document !== "undefined") { result = new RegExp("(?:^|; )" + encodeURIComponent(name) + "=([^;]*)").exec(document.cookie); } return result ? result[1] : null; } /** * @param {?} name * @param {?} value * @return {?} */ export function setLocalStorage(name, value) { localStorage.setItem(name, value); } /** * @param {?} name * @param {?} value * @return {?} */ export function setSessionStorage(name, value) { sessionStorage.setItem(name, value); } /** * @param {?} name * @param {?} value * @param {?=} expiration * @return {?} */ export function setCookie(name, value, expiration) { /** @type {?} */ var expires = ""; if (expiration != null) { /** @type {?} */ var expirationDate = new Date(); expirationDate.setTime(expirationDate.getTime() + (expiration * 24 * 60 * 60 * 1000)); expires = "; expires=" + expirationDate.toUTCString(); } if (typeof document !== "undefined") { document.cookie = name + "=" + value + expires + "; path=/"; } } //# sourceMappingURL=utils.js.map