From a2818e67382c8975476a4b13ae4d8390dbf559a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Edman?= Date: Wed, 24 Jul 2024 07:49:34 +0200 Subject: [PATCH] patch texample --- README.md | 17 +++++++++++++++-- eslint.config.js | 3 ++- package.json | 8 ++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d872683..e037a48 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,18 @@ setTimeout(() => { }, 2000); ``` +With arguments: + +```javascript +import * as ck from 'chronokinesis'; +import assert from 'node:assert'; + +ck.freeze(1980, 0, 1); + +assert.equal(true, ck.isKeepingTime()); +assert.deepEqual(new Date(), new Date(1980, 0, 1)); +``` + or use with [`moment`](http://momentjs.com): ```javascript @@ -180,10 +192,11 @@ Returns [`TimeZoneTraveller` api](#new-timezonetravellertimezone) ```javascript import * as ck from 'chronokinesis'; +ck.reset(); + const tz = ck.timezone('Asia/Shanghai'); -// Now in Shanghai -console.log(new Date()); +console.log('Now in Shanghai', new Date()); tz.freeze(); ``` diff --git a/eslint.config.js b/eslint.config.js index a44ff59..1763cf9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -43,7 +43,8 @@ const rules = { 'no-undef': 2, 'no-underscore-dangle': 0, 'no-unused-expressions': 2, - 'no-use-before-define': 0, + 'no-unused-vars': 2, + 'no-use-before-define': ['error', 'nofunc'], 'no-var': 2, 'no-with': 2, 'prefer-const': ['error', { destructuring: 'all' }], diff --git a/package.json b/package.json index 4c3f7a2..c6ee7c5 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "lint": "eslint . --cache && prettier . --check --cache", "test:lcov": "c8 -r lcov -r text mocha && npm run lint", "cov:html": "c8 mocha -R dot && c8 report --reporter html", - "posttest": "npm run lint && npm run dist && texample", + "posttest": "npm run lint && npm run dist && texample -g", "prepack": "npm run dist", "dist": "npm run toc && rollup -c" }, @@ -54,8 +54,8 @@ "fake now" ], "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "c8": "^9.1.0", + "@rollup/plugin-commonjs": "^26.0.1", + "c8": "^10.1.2", "chai": "^5.1.0", "eslint": "^9.3.0", "lodash.clonedeep": "^4.5.0", @@ -64,6 +64,6 @@ "moment": "^2.30.1", "prettier": "^3.2.5", "rollup": "^4.12.1", - "texample": "^0.0.5" + "texample": "^0.0.6" } }