Skip to content

Commit

Permalink
swap 'now' keyword to '$'
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Nov 1, 2022
1 parent 3fb1827 commit 080b89f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/scriptlets/trusted-set-cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
* - `name` - required, cookie name to be set
* - `value` - required, cookie value. Possible values:
* - arbitrary value
* - `now` keyword for setting current time
* - `$now$` keyword for setting current time
* - 'offsetExpiresSec' - optional, offset from current time in seconds, after which cookie should expire; defaults to no offset
* Possible values:
* - positive integer in seconds
Expand All @@ -42,7 +42,7 @@ import {
*
* 2. Set cookie with `new Date().getTime()` value
* ```
* example.org#%#//scriptlet('set-cookie', 'cmpconsent', 'now')
* example.org#%#//scriptlet('set-cookie', 'cmpconsent', '$now')
* ```
*
* 3. Set cookie which will expire in 3 days
Expand Down Expand Up @@ -80,7 +80,7 @@ export function trustedSetCookie(source, name, value, offsetExpiresSec = '', rel
// eslint-disable-next-line no-console
const log = console.log.bind(console);

const NOW_VALUE_KEYWORD = 'now';
const NOW_VALUE_KEYWORD = '$now$';
const ONE_YEAR_EXPIRATION_KEYWORD = '1year';
const ONE_DAY_EXPIRATION_KEYWORD = '1day';

Expand Down
2 changes: 1 addition & 1 deletion tests/scriptlets/trusted-set-cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('Set cookie string', (assert) => {

test('Set cookie with current time value', (assert) => {
const cName = '__test-cookie_OK';
const cValue = 'currentTime';
const cValue = '$now$';

runScriptlet(name, [cName, cValue]);

Expand Down

0 comments on commit 080b89f

Please sign in to comment.