mm_cache 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compatibility_table.md +12 -2
- package/eslint.config.js +68 -0
- package/package.json +1 -1
package/compatibility_table.md
CHANGED
|
@@ -6,10 +6,20 @@
|
|
|
6
6
|
|-------|-------|---------|-----------|--------|----------|
|
|
7
7
|
| set | ✅ | ✅ | ✅ | ✅ | 所有方式均正常工作 |
|
|
8
8
|
| get | ✅ | ✅ | ✅ | ✅ | 所有方式均正常工作 |
|
|
9
|
-
| del | ✅ | ✅ | ✅ | ✅ |
|
|
9
|
+
| del | ✅ | ✅ | ✅ | ✅ | function (key_path, overwrite = true) {
|
|
10
|
+
if (typeof this !== 'object' || this === null || Array.isArray(this)) {
|
|
11
|
+
throw new TypeError('del方法只能用于普通对象');
|
|
12
|
+
}
|
|
13
|
+
return del(this, key_path, overwrite);
|
|
14
|
+
} |
|
|
10
15
|
| has | ✅ | ✅ | ✅ | ✅ | 所有方式均正常工作 |
|
|
11
16
|
| clear | ✅ | ✅ | ✅ | ✅ | 所有方式功能实现效果相同,返回值一致 |
|
|
12
|
-
| keys | ✅ | ✅ | ✅ | ✅ |
|
|
17
|
+
| keys | ✅ | ✅ | ✅ | ✅ | function (include_proto = false, include_private = false) {
|
|
18
|
+
if (typeof this !== 'object' || this === null) {
|
|
19
|
+
throw new TypeError('keys方法只能用于对象');
|
|
20
|
+
}
|
|
21
|
+
return keys(this, include_proto, include_private);
|
|
22
|
+
} |
|
|
13
23
|
| ttl | ✅ | ✅ | ✅ | ✅ | 所有方式均支持Redis语义,返回-1表示键存在但无过期时间,-2表示键不存在 |
|
|
14
24
|
|
|
15
25
|
## 原子操作方法
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const jsdoc = require('eslint-plugin-jsdoc');
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
files: ['lib/**/*.js'],
|
|
6
|
+
languageOptions: {
|
|
7
|
+
ecmaVersion: 2020,
|
|
8
|
+
sourceType: 'script'
|
|
9
|
+
},
|
|
10
|
+
plugins: {
|
|
11
|
+
jsdoc: jsdoc
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
// JSDoc相关规则 - 设置为error级别强制要求
|
|
15
|
+
'jsdoc/require-jsdoc': ['error', {
|
|
16
|
+
require: {
|
|
17
|
+
FunctionDeclaration: true,
|
|
18
|
+
MethodDefinition: true,
|
|
19
|
+
ClassDeclaration: true,
|
|
20
|
+
ArrowFunctionExpression: true
|
|
21
|
+
}
|
|
22
|
+
}],
|
|
23
|
+
'jsdoc/check-param-names': 'off',
|
|
24
|
+
'jsdoc/check-tag-names': 'off',
|
|
25
|
+
'jsdoc/check-types': 'off',
|
|
26
|
+
'jsdoc/require-param': 'off',
|
|
27
|
+
'jsdoc/require-param-description': 'off',
|
|
28
|
+
'jsdoc/require-returns': 'off',
|
|
29
|
+
'jsdoc/require-returns-description': 'off',
|
|
30
|
+
|
|
31
|
+
// 基础语法规则
|
|
32
|
+
'no-unused-vars': ['error', { args: 'none', vars: 'all' }],
|
|
33
|
+
'no-console': 'warn',
|
|
34
|
+
|
|
35
|
+
// 代码风格规则
|
|
36
|
+
'indent': ['error', 2],
|
|
37
|
+
'quotes': ['error', 'single'],
|
|
38
|
+
'semi': ['error', 'always'],
|
|
39
|
+
'comma-dangle': ['error', 'never'],
|
|
40
|
+
'no-trailing-spaces': 'error',
|
|
41
|
+
'eol-last': 'error',
|
|
42
|
+
'max-len': ['error', { code: 100 }],
|
|
43
|
+
'max-lines-per-function': ['error', { max: 40 }],
|
|
44
|
+
'complexity': ['error', 12],
|
|
45
|
+
'max-depth': ['error', 4],
|
|
46
|
+
'max-params': ['error', 4],
|
|
47
|
+
|
|
48
|
+
// 命名规则
|
|
49
|
+
'id-length': ['error', {
|
|
50
|
+
min: 1,
|
|
51
|
+
max: 20,
|
|
52
|
+
properties: 'always'
|
|
53
|
+
}]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
files: ['test/**/*.js'],
|
|
58
|
+
languageOptions: {
|
|
59
|
+
ecmaVersion: 2020,
|
|
60
|
+
sourceType: 'script'
|
|
61
|
+
},
|
|
62
|
+
rules: {
|
|
63
|
+
// 测试文件中允许使用console
|
|
64
|
+
'no-console': 'off',
|
|
65
|
+
'no-unused-vars': 'off'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
];
|