diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 9e63389..beb3718 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -73,7 +73,7 @@ jobs: - name: set RELEASE number run: echo ${GITHUB_RUN_NUMBER} > RELEASE - name: test - run: cd javascript && make test build + run: cd javascript && make build python: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 2228c2b..51b2684 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Also includes: * **category** Library -* **copyright** 2019-2023 Vonage +* **copyright** 2019-2024 Vonage * **license** [MIT](https://github.com/Vonage/numkey/blob/main/LICENSE) * **link** https://github.com/Vonage/numkey diff --git a/VERSION b/VERSION index 32461d5..5b5dc42 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.25 +1.5.26 diff --git a/c/doc/Doxyfile b/c/doc/Doxyfile index 4c9ab94..367b7b9 100644 --- a/c/doc/Doxyfile +++ b/c/doc/Doxyfile @@ -32,7 +32,7 @@ PROJECT_NAME = "NumKey" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.5.25 +PROJECT_NUMBER = 1.5.26 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/c/nk/nk.c b/c/nk/nk.c index b0db00a..c8681c2 100644 --- a/c/nk/nk.c +++ b/c/nk/nk.c @@ -3,7 +3,7 @@ // nk.c // // @category Tools -// @author Nicola Asuni +// @author Nicola Asuni // @copyright 2019 Vonage // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/c/resources/debian/changelog b/c/resources/debian/changelog index 0228527..1815b98 100644 --- a/c/resources/debian/changelog +++ b/c/resources/debian/changelog @@ -4,4 +4,4 @@ https://github.com/Vonage/numkey commit history - -- Nicola Asuni ~#DATE#~ + -- Nicola Asuni ~#DATE#~ diff --git a/c/src/numkey/binsearch.h b/c/src/numkey/binsearch.h index 1262f66..dee3941 100644 --- a/c/src/numkey/binsearch.h +++ b/c/src/numkey/binsearch.h @@ -6,7 +6,7 @@ // @author Nicola Asuni // @link https://github.com/tecnickcom/binsearch // @license MIT (see https://raw.githubusercontent.com/tecnickcom/binsearch/main/LICENSE) -// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com +// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com /** * @file binsearch.h diff --git a/c/src/numkey/countrykey.h b/c/src/numkey/countrykey.h index 7817049..66b309e 100644 --- a/c/src/numkey/countrykey.h +++ b/c/src/numkey/countrykey.h @@ -3,8 +3,7 @@ // countrykey.h // // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/c/src/numkey/numkey.h b/c/src/numkey/numkey.h index 7574bd0..169b7e4 100644 --- a/c/src/numkey/numkey.h +++ b/c/src/numkey/numkey.h @@ -3,8 +3,7 @@ // numkey.h // // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/c/src/numkey/prefixkey.h b/c/src/numkey/prefixkey.h index 9483723..c8f8ed6 100644 --- a/c/src/numkey/prefixkey.h +++ b/c/src/numkey/prefixkey.h @@ -3,8 +3,7 @@ // prefixkey.h // // @category Libraries -// @author Nicola Asuni -// @copyright 2022-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/c/test/test_binsearch.c b/c/test/test_binsearch.c index ef7d157..5a6a93c 100644 --- a/c/test/test_binsearch.c +++ b/c/test/test_binsearch.c @@ -6,7 +6,7 @@ // @author Nicola Asuni // @link https://github.com/tecnickcom/binsearch // @license MIT (see LICENSE file) -// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com +// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com #if __STDC_VERSION__ >= 199901L #define _XOPEN_SOURCE 600 diff --git a/c/test/test_binsearch_col.c b/c/test/test_binsearch_col.c index 53d297c..9470366 100644 --- a/c/test/test_binsearch_col.c +++ b/c/test/test_binsearch_col.c @@ -6,7 +6,7 @@ // @author Nicola Asuni // @link https://github.com/tecnickcom/binsearch // @license MIT (see LICENSE file) -// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com +// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com #if __STDC_VERSION__ >= 199901L #define _XOPEN_SOURCE 600 diff --git a/c/test/test_binsearch_file.c b/c/test/test_binsearch_file.c index c3c0369..6c5f097 100644 --- a/c/test/test_binsearch_file.c +++ b/c/test/test_binsearch_file.c @@ -6,7 +6,7 @@ // @author Nicola Asuni // @link https://github.com/tecnickcom/binsearch // @license MIT (see LICENSE file) -// @copyright (c) 2017-2023 Nicola Asuni - Tecnick.com +// @copyright (c) 2017-2024 Nicola Asuni - Tecnick.com #if __STDC_VERSION__ >= 199901L #define _XOPEN_SOURCE 600 diff --git a/c/test/test_countrykey.c b/c/test/test_countrykey.c index 44ab5d4..2350ea8 100644 --- a/c/test/test_countrykey.c +++ b/c/test/test_countrykey.c @@ -3,8 +3,7 @@ // test_countrykey.c // // @category Tools -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @lick https://github.com/Vonage/countrykey diff --git a/c/test/test_numkey.c b/c/test/test_numkey.c index 5f770a9..8b3d148 100644 --- a/c/test/test_numkey.c +++ b/c/test/test_numkey.c @@ -3,8 +3,7 @@ // test_numkey.c // // @category Tools -// @author Nicola Asuni -// @copyright 2019 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/c/test/test_prefixkey.c b/c/test/test_prefixkey.c index 5070e5d..62db7b0 100644 --- a/c/test/test_prefixkey.c +++ b/c/test/test_prefixkey.c @@ -3,8 +3,7 @@ // test_prefixkey.c // // @category Tools -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/cgo/src/countrykey_test.go b/cgo/src/countrykey_test.go index e8332d5..9e1c16e 100644 --- a/cgo/src/countrykey_test.go +++ b/cgo/src/countrykey_test.go @@ -2,8 +2,7 @@ package numkey // countrykey_test.go // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @lick https://github.com/Vonage/countrykey diff --git a/cgo/src/numkey.go b/cgo/src/numkey.go index 962a1db..46b7d84 100644 --- a/cgo/src/numkey.go +++ b/cgo/src/numkey.go @@ -2,8 +2,7 @@ // 64 bit Encoding for Short Codes and E.164 LVN. // // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey package numkey diff --git a/cgo/src/numkey_test.go b/cgo/src/numkey_test.go index bc56f8f..873b72d 100644 --- a/cgo/src/numkey_test.go +++ b/cgo/src/numkey_test.go @@ -2,8 +2,7 @@ package numkey // numkey_test.go // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/cgo/src/prefixkey_test.go b/cgo/src/prefixkey_test.go index 2d7f555..8b478a6 100644 --- a/cgo/src/prefixkey_test.go +++ b/cgo/src/prefixkey_test.go @@ -2,8 +2,7 @@ package numkey // prefixkey_test.go // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/go/src/countrykey_test.go b/go/src/countrykey_test.go index 43f313b..7a9cd69 100644 --- a/go/src/countrykey_test.go +++ b/go/src/countrykey_test.go @@ -2,8 +2,7 @@ package numkey // countrykey_test.go // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @lick https://github.com/Vonage/countrykey diff --git a/go/src/numkey.go b/go/src/numkey.go index 7fc5669..92c9ce7 100644 --- a/go/src/numkey.go +++ b/go/src/numkey.go @@ -1,8 +1,7 @@ // Package numkey provides 64 bit Encoding for Short Codes and E.164 LVN. // // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2020 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey package numkey diff --git a/go/src/numkey_test.go b/go/src/numkey_test.go index ddd32e8..4ffe0d0 100644 --- a/go/src/numkey_test.go +++ b/go/src/numkey_test.go @@ -2,8 +2,7 @@ package numkey // numkey_test.go // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/go/src/prefixkey_test.go b/go/src/prefixkey_test.go index c67ba51..cdb6225 100644 --- a/go/src/prefixkey_test.go +++ b/go/src/prefixkey_test.go @@ -2,8 +2,7 @@ package numkey // prefixkey_test.go // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/javascript/Makefile b/javascript/Makefile index 56f64ec..e4c0708 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -28,10 +28,9 @@ all: clean format test build # Build a minified version of the library .PHONY: build -build: +build: test @mkdir -p target/build - uglifyjs --compress --keep-fnames --comments --output target/build/numkey.js src/numkey.js - cd test && node test_numkey.js '../target/build/numkey.js' + uglifyjs --compress --keep-fnames --comments --output target/build/numkey.js src/numkey.js # Remove any build artifact .PHONY: clean diff --git a/javascript/src/numkey.js b/javascript/src/numkey.js index 7ac66ed..ef5454b 100644 --- a/javascript/src/numkey.js +++ b/javascript/src/numkey.js @@ -3,43 +3,42 @@ * numkey.js * * @category Libraries - * @author Nicola Asuni - * @copyright 2019-2020 Vonage + * @author Nicola Asuni * @license see LICENSE file * @link https://github.com/Vonage/numkey */ // NOTE: Javascript numbers are 64 bit floats with a 53 bit precision. -var NKBMASK_COUNTRY_FL = 0xF8000000 //!< Bit mask for the ISO 3166 alpha-2 country code first letter [ 11111000 00000000 00000000 00000000 ] -var NKBMASK_COUNTRY_SL = 0x07C00000 //!< Bit mask for the ISO 3166 alpha-2 country code second letter [ 00000111 11000000 00000000 00000000 ] +const NKBMASK_COUNTRY_FL = 0xF8000000 //!< Bit mask for the ISO 3166 alpha-2 country code first letter [ 11111000 00000000 00000000 00000000 ] +const NKBMASK_COUNTRY_SL = 0x07C00000 //!< Bit mask for the ISO 3166 alpha-2 country code second letter [ 00000111 11000000 00000000 00000000 ] -var NKBMASK_NUMBER_HI = 0x003FFFFF //!< Bit mask for the hi part of short code or E.164 number (max 15 digits) [ 00000000 00111111 11111111 11111111 ] -var NKBMASK_NUMBER_LO = 0xFFFFFFF0 //!< Bit mask for the lo part of short code or E.164 number (max 15 digits) [ 11111111 11111111 11111111 11110000 ] +const NKBMASK_NUMBER_HI = 0x003FFFFF //!< Bit mask for the hi part of short code or E.164 number (max 15 digits) [ 00000000 00111111 11111111 11111111 ] +const NKBMASK_NUMBER_LO = 0xFFFFFFF0 //!< Bit mask for the lo part of short code or E.164 number (max 15 digits) [ 11111111 11111111 11111111 11110000 ] -var NKBMASK_32 = 0xFFFFFFFF //!< 32-Bit mask [ 11111111 11111111 11111111 11111111 ] +const NKBMASK_32 = 0xFFFFFFFF //!< 32-Bit mask [ 11111111 11111111 11111111 11111111 ] -var NKBMASK_LENGTH = 0x0000000F //!< Bit mask for the number length [ 00000000 00000000 00000000 00001111 ] +const NKBMASK_LENGTH = 0x0000000F //!< Bit mask for the number length [ 00000000 00000000 00000000 00001111 ] -var NKBSHIFT_COUNTRY_FL = 27 //!< COUNTRY first letter LSB position from the NumKey LSB -var NKBSHIFT_COUNTRY_SL = 22 //!< COUNTRY second letter LSB position from the NumKey LSB +const NKBSHIFT_COUNTRY_FL = 27 //!< COUNTRY first letter LSB position from the NumKey LSB +const NKBSHIFT_COUNTRY_SL = 22 //!< COUNTRY second letter LSB position from the NumKey LSB -var NKBSHIFT_NUMBER_HI = 10 //!< NUMBER MSB position from the NumKey MSB -var NKBSHIFT_NUMBER_LO = 4 //!< NUMBER LSB position from the NumKey LSB +const NKBSHIFT_NUMBER_HI = 10 //!< NUMBER MSB position from the NumKey MSB +const NKBSHIFT_NUMBER_LO = 4 //!< NUMBER LSB position from the NumKey LSB -var NKSLENGTH_COUNTRY = 3 //!< Number of characters in the country code + NULL terminator -var NKSLENGTH_NUMBER = 16 //!< Number of characters in the number code + NULL terminator +const NKSLENGTH_COUNTRY = 3 //!< Number of characters in the country code + NULL terminator +const NKSLENGTH_NUMBER = 16 //!< Number of characters in the number code + NULL terminator -var NKCSHIFT_CHAR = 64 //!< Value shift to encode characters to numbers (A=1, ..., Z=26) +const NKCSHIFT_CHAR = 64 //!< Value shift to encode characters to numbers (A=1, ..., Z=26) -var NKNUMDIV = 0x10000000 //!< = [2^28] divider to get the number HI bits -var NKNUMMUL = 0x100000000 //!< = [2^32] multiplier to set the number HI bits +const NKNUMDIV = 0x10000000 //!< = [2^28] divider to get the number HI bits +const NKNUMMUL = 0x100000000 //!< = [2^32] multiplier to set the number HI bits -var NKZEROSHIFT = 48 //!< ASCII code of the '0' character +const NKZEROSHIFT = 48 //!< ASCII code of the '0' character -var NKNUMMAXLEN = 15 //!< Maximum number length for E.164 and key reversibility +const NKNUMMAXLEN = 15 //!< Maximum number length for E.164 and key reversibility -var PKNUMMAXLEN = 15 //!< Maximum number of digits to store for the prefixkey. +const PKNUMMAXLEN = 15 //!< Maximum number of digits to store for the prefixkey. function encodeChar(c) { return ((c - NKCSHIFT_CHAR) >>> 0) @@ -54,7 +53,7 @@ function decodeCountry(nk) { } function encodeNumber(number) { - var size = number.length; + const size = number.length; if (size < 1) { return { "hi": 0, @@ -80,13 +79,13 @@ function encodeNumber(number) { } function decodeNumber(nk) { - var size = (nk.lo & NKBMASK_LENGTH) >>> 0; + const size = (nk.lo & NKBMASK_LENGTH) >>> 0; if (size == 0) { return ""; } - var number = new Array(size); - var numhi = ((nk.hi & NKBMASK_NUMBER_HI) >>> 0); - var numlo = ((nk.lo & NKBMASK_NUMBER_LO) >>> 0); + const number = new Array(size); + const numhi = ((nk.hi & NKBMASK_NUMBER_HI) >>> 0); + const numlo = ((nk.lo & NKBMASK_NUMBER_LO) >>> 0); var num = ((numhi >>> NKBSHIFT_NUMBER_LO) * NKNUMMUL) + (((numhi << (32 - NKBSHIFT_NUMBER_LO)) >>> 0) + (numlo >>> NKBSHIFT_NUMBER_LO)); var rem = 0; var i; @@ -99,7 +98,7 @@ function decodeNumber(nk) { } function numKey(country, number) { - var ne = encodeNumber(number); + const ne = encodeNumber(number); return { "hi": ((encodeCountry(country) | ne.hi) >>> 0), "lo": ne.lo diff --git a/javascript/test/test_numkey.js b/javascript/test/test_numkey.js index 5607936..2869986 100644 --- a/javascript/test/test_numkey.js +++ b/javascript/test/test_numkey.js @@ -3,7 +3,7 @@ * test_numkey.js * * @category Libraries - * @author Nicola Asuni + * @author Nicola Asuni * @copyright 2019 Vonage * @license see LICENSE file * @link https://github.com/Vonage/numkey diff --git a/python/numkey/pynumkey.c b/python/numkey/pynumkey.c index 05c4e70..9e12ae3 100644 --- a/python/numkey/pynumkey.c +++ b/python/numkey/pynumkey.c @@ -3,8 +3,7 @@ // pynumkey.c // // @category Libraries -// @author Nicola Asuni -// @copyright 2019-2022 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/python/numkey/pynumkey.h b/python/numkey/pynumkey.h index 065d63a..bfff150 100644 --- a/python/numkey/pynumkey.h +++ b/python/numkey/pynumkey.h @@ -3,8 +3,7 @@ // pynumkey.h // // @category Libraries -// @author Nicola Asuni -// @copyright 2019 Vonage +// @author Nicola Asuni // @license see LICENSE file // @link https://github.com/Vonage/numkey diff --git a/python/setup.py b/python/setup.py index 69b2271..d9d8b60 100644 --- a/python/setup.py +++ b/python/setup.py @@ -30,7 +30,7 @@ def run(self): setup( name="numkey", - version="1.5.25.1", + version="1.5.26.1", keywords=("numkey E.164 shortcode lvn did encoding"), description="NumKey Bindings for Python", long_description=read("../README.md"), diff --git a/python/test/test_numkey.py b/python/test/test_numkey.py index db3b6f7..6b4351b 100644 --- a/python/test/test_numkey.py +++ b/python/test/test_numkey.py @@ -2,7 +2,7 @@ # test_numkey.py # @category Libraries -# @author Nicola Asuni +# @author Nicola Asuni # @copyright 2019 Vonage # @license see LICENSE file # @link https://github.com/Vonage/numkey