@types/js-cookie
Advanced tools
Comparing version 2.2.7 to 3.0.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for js-cookie 2.2 | ||
// Type definitions for js-cookie 3.0 | ||
// Project: https://github.com/js-cookie/js-cookie | ||
@@ -8,4 +8,4 @@ // Definitions by: Theodore Brown <https://github.com/theodorejb> | ||
// Nicolas Reynis <https://github.com/nreynis> | ||
// Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
@@ -53,8 +53,4 @@ declare namespace Cookies { | ||
interface CookiesStatic<T extends object = object> { | ||
readonly converter: Required<Converter<T>>; | ||
/** | ||
* Allows default cookie attributes to be accessed, changed, or reset | ||
*/ | ||
defaults: CookieAttributes; | ||
/** | ||
* Create a cookie | ||
@@ -72,17 +68,5 @@ */ | ||
*/ | ||
get(): {[key: string]: string}; | ||
get(): { [key: string]: string }; | ||
/** | ||
* Returns the parsed representation of the string | ||
* stored in the cookie according to JSON.parse | ||
*/ | ||
getJSON(name: string): any; | ||
/** | ||
* Returns the parsed representation of | ||
* all cookies according to JSON.parse | ||
*/ | ||
getJSON(): {[key: string]: any}; | ||
/** | ||
* Delete cookie | ||
@@ -93,10 +77,8 @@ */ | ||
/** | ||
* If there is any danger of a conflict with the namespace Cookies, | ||
* the noConflict method will allow you to define a new namespace | ||
* and preserve the original one. This is especially useful when | ||
* running the script on third party sites e.g. as part of a widget | ||
* or SDK. Note: The noConflict method is not necessary when using | ||
* AMD or CommonJS, thus it is not exposed in those environments. | ||
* Cookie attribute defaults can be set globally by creating an | ||
* instance of the api via withAttributes(), or individually for | ||
* each call to Cookies.set(...) by passing a plain object as the | ||
* last argument. Per-call attributes override the default attributes. | ||
*/ | ||
noConflict?(): CookiesStatic<T>; | ||
withAttributes(attributes: CookieAttributes): CookiesStatic<T>; | ||
@@ -110,5 +92,10 @@ /** | ||
*/ | ||
withConverter<TConv extends object>(converter: CookieReadConverter | { write?: CookieWriteConverter<TConv> | undefined; read?: CookieReadConverter | undefined; }): CookiesStatic<TConv>; | ||
withConverter<TConv extends object>(converter: Converter<TConv>): CookiesStatic<TConv>; | ||
} | ||
interface Converter<TConv extends object> { | ||
write?: CookieWriteConverter<TConv> | undefined; | ||
read?: CookieReadConverter | undefined; | ||
} | ||
type CookieWriteConverter<T extends object> = (value: string | T, name: string) => string; | ||
@@ -118,5 +105,15 @@ type CookieReadConverter = (value: string, name: string) => string; | ||
declare const Cookies: Cookies.CookiesStatic; | ||
declare const Cookies: Cookies.CookiesStatic & { | ||
/** | ||
* If there is any danger of a conflict with the namespace Cookies, | ||
* the noConflict method will allow you to define a new namespace | ||
* and preserve the original one. This is especially useful when | ||
* running the script on third party sites e.g. as part of a widget | ||
* or SDK. Note: The noConflict method is not necessary when using | ||
* AMD or CommonJS, thus it is not exposed in those environments. | ||
*/ | ||
noConflict?(): Cookies.CookiesStatic; | ||
}; | ||
export = Cookies; | ||
export as namespace Cookies; |
{ | ||
"name": "@types/js-cookie", | ||
"version": "2.2.7", | ||
"version": "3.0.0", | ||
"description": "TypeScript definitions for js-cookie", | ||
@@ -32,2 +32,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-cookie", | ||
"githubUsername": "nreynis" | ||
}, | ||
{ | ||
"name": "Piotr Błażejewicz", | ||
"url": "https://github.com/peterblazejewicz", | ||
"githubUsername": "peterblazejewicz" | ||
} | ||
@@ -44,4 +49,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "4c4affe1d1b24aed086239e7e5404ff729b04a34e42f14081b888e71c553a411", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "64eeaed1a26608de0e93a8c2ee8e9af5daad94b8db858ed9f7fa097839ecb48e", | ||
"typeScriptVersion": "3.7" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 06 Jul 2021 21:33:45 GMT | ||
* Last updated: Fri, 01 Oct 2021 22:31:30 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: `Cookies` | ||
# Credits | ||
These definitions were written by [Theodore Brown](https://github.com/theodorejb), [BendingBender](https://github.com/BendingBender), [Antoine Lépée](https://github.com/alepee), [Yuto Doi](https://github.com/yutod), and [Nicolas Reynis](https://github.com/nreynis). | ||
These definitions were written by [Theodore Brown](https://github.com/theodorejb), [BendingBender](https://github.com/BendingBender), [Antoine Lépée](https://github.com/alepee), [Yuto Doi](https://github.com/yutod), [Nicolas Reynis](https://github.com/nreynis), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7665
97