@lijuhong1981/jscheck 1.0.4 → 1.0.5

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/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `@lijuhong1981/jscheck`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const jscheck = require('@lijuhong1981/jscheck');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import Check from "./src/Check.js";
2
- import defined from "./src/defined.js";
3
- import definedValue from "./src/definedValue.js";
2
+ import isDefined from "./src/isDefined.js";
3
+ import getDefinedValue from "./src/getDefinedValue.js";
4
4
  import isArray from "./src/isArray.js";
5
5
  import isBoolean from "./src/isBoolean.js";
6
6
  import isFunction from "./src/isFunction.js";
@@ -14,8 +14,9 @@ import getValidValue from "./src/getValidValue.js";
14
14
 
15
15
  export default Check;
16
16
  export {
17
- defined,
18
- definedValue,
17
+ Check,
18
+ isDefined,
19
+ getDefinedValue,
19
20
  isArray,
20
21
  isBoolean,
21
22
  isFunction,
package/package.json CHANGED
@@ -1,21 +1,18 @@
1
1
  {
2
2
  "name": "@lijuhong1981/jscheck",
3
- "version": "1.0.4",
4
- "description": "",
3
+ "version": "1.0.5",
4
+ "description": "> TODO: description",
5
+ "author": "lijuhong1981",
6
+ "homepage": "https://github.com/lijuhong1981/jslib#readme",
7
+ "license": "ISC",
8
+ "type": "module",
5
9
  "main": "index.js",
6
10
  "module": "index.js",
7
- "type": "module",
8
- "scripts": {
9
- "test": "echo \"Error: no test specified\" && exit 1"
10
- },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/lijuhong1981/jscheck.git"
13
+ "url": "git+https://github.com/lijuhong1981/jslib.git"
14
14
  },
15
- "author": "lijuhong1981",
16
- "license": "ISC",
17
15
  "bugs": {
18
- "url": "https://github.com/lijuhong1981/jscheck/issues"
19
- },
20
- "homepage": "https://github.com/lijuhong1981/jscheck#readme"
21
- }
16
+ "url": "https://github.com/lijuhong1981/jslib/issues"
17
+ }
18
+ }
package/src/Check.js CHANGED
@@ -1,4 +1,4 @@
1
- import defined from "./defined.js";
1
+ import isDefined from "./isDefined.js";
2
2
  import isValid from "./isValid.js";
3
3
 
4
4
  const Check = {};
@@ -25,12 +25,12 @@ function getFailedTypeErrorMessage(actual, expected, name) {
25
25
  }
26
26
 
27
27
  Check.defined = function (name, test) {
28
- if (!defined(test)) {
28
+ if (!isDefined(test)) {
29
29
  throw new Error(getUndefinedErrorMessage(name));
30
30
  }
31
31
  };
32
32
 
33
- Check.isValid = function (name, test) {
33
+ Check.valid = function (name, test) {
34
34
  if (!isValid(test)) {
35
35
  throw new Error(getInvalidErrorMessage(name));
36
36
  }
@@ -0,0 +1,10 @@
1
+ import isDefined from "./isDefined.js";
2
+
3
+ function getDefinedValue(...args) {
4
+ for (let i = 0; i < args.length; i++) {
5
+ if (isDefined(args[i]))
6
+ return args[i];
7
+ }
8
+ };
9
+
10
+ export default getDefinedValue;
@@ -0,0 +1,5 @@
1
+ function isDefined(value) {
2
+ return value !== undefined && value !== null;
3
+ };
4
+
5
+ export default isDefined;
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
package/src/defined.js DELETED
@@ -1,5 +0,0 @@
1
- function defined(value) {
2
- return value !== undefined && value !== null;
3
- };
4
-
5
- export default defined;
@@ -1,10 +0,0 @@
1
- import defined from "./defined.js";
2
-
3
- function definedValue(...args) {
4
- for (let i = 0; i < args.length; i++) {
5
- if (defined(args[i]))
6
- return args[i];
7
- }
8
- };
9
-
10
- export default definedValue;