@lijuhong1981/jscheck 1.1.5 → 1.1.6

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.
Files changed (2) hide show
  1. package/package.json +22 -22
  2. package/src/Check.js +14 -14
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
- {
2
- "name": "@lijuhong1981/jscheck",
3
- "version": "1.1.5",
4
- "description": "> TODO: description",
5
- "author": "lijuhong1981 <lijuhong@hotmail.com>",
6
- "homepage": "https://github.com/lijuhong1981/jslibs#readme",
7
- "license": "ISC",
8
- "type": "module",
9
- "main": "index.js",
10
- "module": "index.js",
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/lijuhong1981/jslibs.git"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/lijuhong1981/jslibs/issues"
20
- },
21
- "gitHead": "0aa8a09a9c5bc3ad3fd3710892adf1efb223e5a6"
22
- }
1
+ {
2
+ "name": "@lijuhong1981/jscheck",
3
+ "version": "1.1.6",
4
+ "description": "> TODO: description",
5
+ "author": "lijuhong1981 <lijuhong@hotmail.com>",
6
+ "homepage": "https://github.com/lijuhong1981/jslibs#readme",
7
+ "license": "ISC",
8
+ "type": "module",
9
+ "main": "index.js",
10
+ "module": "index.js",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/lijuhong1981/jslibs.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/lijuhong1981/jslibs/issues"
20
+ },
21
+ "gitHead": "0aa8a09a9c5bc3ad3fd3710892adf1efb223e5a6"
22
+ }
package/src/Check.js CHANGED
@@ -56,6 +56,20 @@ Check.valid = function (name, test) {
56
56
  throw new Error(getInvalidErrorMessage(name));
57
57
  }
58
58
  };
59
+ /**
60
+ * 检查值是否为指定类的实例
61
+ * @param {string} name 值的名称
62
+ * @param {any} test 需要检查的值
63
+ * @param {Function} target 指定类
64
+ * @throws {Error} 如果值不是指定类的实例,则抛出错误
65
+ * @static
66
+ * @memberof Check
67
+ */
68
+ Check.instanceOf = function (name, test, target) {
69
+ if (test instanceof target === false) {
70
+ throw new Error(getFailedTypeErrorMessage(false, target.name, name));
71
+ }
72
+ };
59
73
  /**
60
74
  * 检查值是否为函数
61
75
  * @param {string} name 值的名称
@@ -389,20 +403,6 @@ Check.typeOf.integer.equals = function (name1, name2, test1, test2) {
389
403
  );
390
404
  }
391
405
  };
392
- /**
393
- * 检查值是否为指定类的实例
394
- * @param {string} name 值的名称
395
- * @param {any} test 需要检查的值
396
- * @param {Function} target 指定类
397
- * @throws {Error} 如果值不是指定类的实例,则抛出错误
398
- * @static
399
- * @memberof Check.typeOf
400
- */
401
- Check.typeOf.instanceOf = function (name, test, target) {
402
- if (test instanceof target === false) {
403
- throw new Error(getFailedTypeErrorMessage(false, target.name, name));
404
- }
405
- };
406
406
  /**
407
407
  * 检查两个值是否已定义且相等
408
408
  * @param {string} name1 值1的名称