Closed e110c0 closed 3 years ago
@bropat are you certain this branch is resolving the issue for you? please check, since the code changes are only cosmetically so far.
if it doesn't fix it, please open an issue with an example of how to reproduce the problem. thank you
@e110c0
You're right it doesn't fix everything, one function is missing and that is here the this.
should be removed.
@e110c0
Here is a quick test case:
mkdir testcase
cd testcase
git init
npm init --y
npm i --save-prod @cospired/i18n-iso-languages
npm i -g typescript
mkdir src
cd src
Create the file testcase.ts
with following content:
import { isValid as isValidLanguageCode } from "@cospired/i18n-iso-languages"
console.log(`isValidLanguageCode: ${isValidLanguageCode("en")}`);
Compile and execute it:
tsc testcase.ts
node testcase.js
D:\Projects\private\testcase\node_modules\@cospired\i18n-iso-languages\index.js:265
return this.toAlpha3T(code) !== undefined;
^
TypeError: Cannot read property 'toAlpha3T' of undefined
at exports.isValid (D:\Projects\private\testcase\node_modules\@cospired\i18n-iso-languages\index.js:265:15)
at Object.<anonymous> (D:\Projects\private\testcase\src\testcase.js:4:72)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
If I remove the this.
above, it will work.
I created an issue #41
@e110c0
Hi,
can you publish these changes?
With the current version (3.1.0) I have problems in the last NodeJs and Typescript versions with some functions that are called internally via
this.
(get an undefined exception). For example here