Skip to content

Commit

Permalink
Fixed the detection of undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
fenying committed Jan 3, 2019
1 parent 4486ece commit 8b84f76
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes Logs

## v0.3.1

- Fixed the `undefined` detection.

## v0.3.0

- Upgrade TypeScript compiler to `v2.9.2`.
Expand Down
10 changes: 0 additions & 10 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,3 @@ incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work

To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "{}" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@litert/typeguard",
"version": "0.3.0",
"version": "0.3.1",
"description": "A type checking code \"JIT\" library.",
"main": "lib/index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/common.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2018 Angus.Fenying <fenying@litert.org>
* Copyright 2019 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -278,7 +278,7 @@ export interface Language {

getRegExpVerifyStatement(v: string, r: string): string;

getBooleanValueCheckStatement(varName: string, value: number): string;
getBooleanValueCheckStatement(varName: string, value: boolean): string;

createArrayIteration(arr: string, iter: string, body: string): string;

Expand Down
4 changes: 2 additions & 2 deletions src/compiler.javascript.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2018 Angus.Fenying <fenying@litert.org>
* Copyright 2019 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
9 changes: 4 additions & 5 deletions src/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2018 Angus.Fenying <fenying@litert.org>
* Copyright 2019 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -1008,9 +1008,8 @@ implements Compiler {

case "undefined":

return `(${this._lang.getBooleanValueCheckStatement(
varName,
theType
return `(${this._lang.getUndefinedCheckStatement(
varName
)})`;

default:
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2018 Angus.Fenying <fenying@litert.org>
* Copyright 2019 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
6 changes: 3 additions & 3 deletions src/lang.javascript.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2018 Angus.Fenying <fenying@litert.org>
* Copyright 2019 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -351,7 +351,7 @@ implements Language {

public getBooleanValueCheckStatement(
varName: string,
value: number
value: boolean
): string {

return `${varName} === ${value ? "true" : "false"}`;
Expand Down
4 changes: 2 additions & 2 deletions src/tests.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2018 Angus.Fenying <fenying@litert.org>
* Copyright 2019 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"radix": false,
"no-var-requires": false,
"no-bitwise": false,
"prefer-for-of": false
"prefer-for-of": false,
"function-constructor": false
},
"rulesDirectory": []
}

0 comments on commit 8b84f76

Please sign in to comment.