|
[canonicalDomain(domainName)](./tough-cookie.canonicaldomain.md)
|
Transforms a domain name into a canonical domain name. The canonical domain name is a domain name that has been trimmed, lowercased, stripped of leading dot, and optionally punycode-encoded ([Section 5.1.2 of RFC 6265](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.2)). For the most part, this function is idempotent (calling the function with the output from a previous call returns the same output).
|
|
[cookieCompare(a, b)](./tough-cookie.cookiecompare.md)
|
A comparison function that can be used with [Array.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort), which orders a list of cookies into the recommended order given in Step 2 of [RFC6265 - Section 5.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4).
The sort algorithm is, in order of precedence:
- Longest [Cookie.path](./tough-cookie.cookie.path.md)
- Oldest [Cookie.creation](./tough-cookie.cookie.creation.md) (which has a 1-ms precision, same as Date)
- Lowest [Cookie.creationIndex](./tough-cookie.cookie.creationindex.md) (to get beyond the 1-ms precision)
|
|
[defaultPath(path)](./tough-cookie.defaultpath.md)
|
Given a current request/response path, gives the path appropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by [RFC6265 - Section 5.1.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.4).
|
|
[domainMatch(domain, cookieDomain, canonicalize)](./tough-cookie.domainmatch.md)
|
Answers "does this real domain match the domain in a cookie?". The `domain` is the "current" domain name and the `cookieDomain` is the "cookie" domain name. Matches according to [RFC6265 - Section 5.1.3](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.3), but it helps to think of it as a "suffix match".
|
|
[formatDate(date)](./tough-cookie.formatdate.md)
|
Format a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) into the [preferred Internet standard format](https://www.rfc-editor.org/rfc/rfc2616#section-3.3.1) defined in [RFC822](https://www.rfc-editor.org/rfc/rfc822#section-5) and updated in [RFC1123](https://www.rfc-editor.org/rfc/rfc1123#page-55).
|
|
[fromJSON(str)](./tough-cookie.fromjson.md)
|
Does the reverse of [Cookie.toJSON()](./tough-cookie.cookie.tojson.md).
|
|
[getPublicSuffix(domain, options)](./tough-cookie.getpublicsuffix.md)
|
Returns the public suffix of this hostname. The public suffix is the shortest domain name upon which a cookie can be set.
|
|
[parse(str, options)](./tough-cookie.parse.md)
|
Parses a string into a Cookie object.
|
|
[parseDate(cookieDate)](./tough-cookie.parsedate.md)
|
Parse a cookie date string into a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). Parses according to [RFC6265 - Section 5.1.1](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.1), not [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
|
|
[pathMatch(reqPath, cookiePath)](./tough-cookie.pathmatch.md)
|
Answers "does the request-path path-match a given cookie-path?" as per [RFC6265 Section 5.1.4](https://www.rfc-editor.org/rfc/rfc6265.html#section-5.1.4). This is essentially a prefix-match where cookiePath is a prefix of reqPath.
|
|
[permuteDomain(domain, allowSpecialUseDomain)](./tough-cookie.permutedomain.md)
|
Generates the permutation of all possible values that [domainMatch()](./tough-cookie.domainmatch.md) the given `domain` parameter. The array is in shortest-to-longest order. Useful when building custom [Store](./tough-cookie.store.md) implementations.
|
|
[permutePath(path)](./tough-cookie.permutepath.md)
|
Generates the permutation of all possible values that [pathMatch()](./tough-cookie.pathmatch.md) the `path` parameter. The array is in longest-to-shortest order. Useful when building custom [Store](./tough-cookie.store.md) implementations.
|