From 1fc2ef32e490816911b3d89c4e1ca40c8e511aef Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Mon, 23 Dec 2019 15:59:19 +0200 Subject: [PATCH] typescript(option): test: added tests for bind Signed-off-by: prescientmoon --- typescript/option/package.json | 8 +- typescript/option/pnpm-lock.yaml | 459 ++++++++++++++++++++- typescript/option/src/helpers/bind.test.ts | 32 ++ typescript/option/tsconfig.json | 1 + 4 files changed, 498 insertions(+), 2 deletions(-) create mode 100644 typescript/option/src/helpers/bind.test.ts diff --git a/typescript/option/package.json b/typescript/option/package.json index c98aa4e..af5d47f 100644 --- a/typescript/option/package.json +++ b/typescript/option/package.json @@ -7,7 +7,8 @@ "typings": "dist/index.esm.d.ts", "scripts": { "prebuild": "rimraf dist", - "build": "rollup -c rollup.config.ts" + "build": "rollup -c rollup.config.ts", + "test": "mocha -r ts-node/register src/**/*.test.ts" }, "publishConfig": { "access": "public" @@ -26,12 +27,17 @@ "devDependencies": { "@rollup/plugin-commonjs": "^11.0.0", "@rollup/plugin-node-resolve": "^6.0.0", + "@types/chai": "^4.2.7", + "@types/mocha": "^5.2.7", "@types/node": "^12.12.21", "@wessberg/rollup-plugin-ts": "^1.1.83", + "chai": "^4.2.0", + "mocha": "^6.2.2", "rimraf": "^3.0.0", "rollup": "^1.27.14", "rollup-plugin-terser": "^5.1.3", "semantic-release": "^15.14.0", + "ts-node": "^8.5.4", "typescript": "^3.7.4", "utility-types": "^3.10.0" }, diff --git a/typescript/option/pnpm-lock.yaml b/typescript/option/pnpm-lock.yaml index 3271d76..0fbc0cd 100644 --- a/typescript/option/pnpm-lock.yaml +++ b/typescript/option/pnpm-lock.yaml @@ -4,12 +4,17 @@ dependencies: devDependencies: '@rollup/plugin-commonjs': 11.0.0_rollup@1.27.14 '@rollup/plugin-node-resolve': 6.0.0_rollup@1.27.14 + '@types/chai': 4.2.7 + '@types/mocha': 5.2.7 '@types/node': 12.12.21 '@wessberg/rollup-plugin-ts': 1.1.83_rollup@1.27.14+typescript@3.7.4 + chai: 4.2.0 + mocha: 6.2.2 rimraf: 3.0.0 rollup: 1.27.14 rollup-plugin-terser: 5.1.3_rollup@1.27.14 semantic-release: 15.14.0_semantic-release@15.14.0 + ts-node: 8.5.4_typescript@3.7.4 typescript: 3.7.4 utility-types: 3.10.0 lockfileVersion: 5.1 @@ -969,6 +974,10 @@ packages: dev: false resolution: integrity: sha512-M0T8m+H+FDAFi6Oe8FTYQWTBgx+xrwsstiH4KzSUGjDGmJ7Hi/FSfwmBPIslrRVnrnJKwBk41aYQ1tk3J6CNKw== + /@types/chai/4.2.7: + dev: true + resolution: + integrity: sha512-luq8meHGYwvky0O7u0eQZdA7B4Wd9owUCqvbw2m3XCrCU8mplYOujMBbvyS547AxJkC+pGnd0Cm15eNxEUNU8g== /@types/color-name/1.1.1: dev: true resolution: @@ -1003,6 +1012,10 @@ packages: dev: true resolution: integrity: sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg== + /@types/mocha/5.2.7: + dev: true + resolution: + integrity: sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ== /@types/node/12.12.21: dev: true resolution: @@ -1130,12 +1143,30 @@ packages: node: '>=8' resolution: integrity: sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA== + /ansi-colors/3.2.3: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== /ansi-escapes/3.2.0: dev: true engines: node: '>=4' resolution: integrity: sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + /ansi-regex/3.0.0: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + /ansi-regex/4.1.0: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== /ansi-regex/5.0.0: dev: true engines: @@ -1163,6 +1194,16 @@ packages: dev: true resolution: integrity: sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk= + /arg/4.1.2: + dev: true + resolution: + integrity: sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg== + /argparse/1.0.10: + dependencies: + sprintf-js: 1.0.3 + dev: true + resolution: + integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== /argv-formatter/1.0.0: dev: true resolution: @@ -1189,6 +1230,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= + /assertion-error/1.1.0: + dev: true + resolution: + integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== /atob-lite/2.0.0: dev: true resolution: @@ -1226,6 +1271,10 @@ packages: node: '>=8' resolution: integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + /browser-stdout/1.3.1: + dev: true + resolution: + integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== /browserslist/4.7.2: dependencies: caniuse-lite: 1.0.30001016 @@ -1298,6 +1347,19 @@ packages: hasBin: true resolution: integrity: sha1-fMEFXYItISlU0HsIXeolHMe8VQU= + /chai/4.2.0: + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.2 + deep-eql: 3.0.1 + get-func-name: 2.0.0 + pathval: 1.1.0 + type-detect: 4.0.8 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw== /chalk/2.4.2: dependencies: ansi-styles: 3.2.1 @@ -1308,6 +1370,10 @@ packages: node: '>=4' resolution: integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + /check-error/1.0.2: + dev: true + resolution: + integrity: sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= /clean-stack/2.2.0: dev: true engines: @@ -1322,6 +1388,14 @@ packages: node: '>= 0.2.0' resolution: integrity: sha1-9TsFJmqLGguTSz0IIebi3FkUriM= + /cliui/5.0.0: + dependencies: + string-width: 3.1.0 + strip-ansi: 5.2.0 + wrap-ansi: 5.1.0 + dev: true + resolution: + integrity: sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== /cliui/6.0.0: dependencies: string-width: 4.2.0 @@ -1501,7 +1575,7 @@ packages: integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== /debug/3.2.6: dependencies: - ms: 2.1.2 + ms: 2.1.1 dev: true resolution: integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -1526,6 +1600,14 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + /deep-eql/3.0.1: + dependencies: + type-detect: 4.0.8 + dev: true + engines: + node: '>=0.12' + resolution: + integrity: sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw== /deep-extend/0.6.0: dev: true engines: @@ -1544,6 +1626,18 @@ packages: dev: true resolution: integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== + /diff/3.5.0: + dev: true + engines: + node: '>=0.3.1' + resolution: + integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== + /diff/4.0.1: + dev: true + engines: + node: '>=0.3.1' + resolution: + integrity: sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== /dir-glob/3.0.1: dependencies: path-type: 4.0.0 @@ -1570,6 +1664,10 @@ packages: dev: true resolution: integrity: sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA== + /emoji-regex/7.0.3: + dev: true + resolution: + integrity: sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== /emoji-regex/8.0.0: dev: true resolution: @@ -1595,6 +1693,34 @@ packages: dev: true resolution: integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + /es-abstract/1.17.0: + dependencies: + es-to-primitive: 1.2.1 + function-bind: 1.1.1 + has: 1.0.3 + has-symbols: 1.0.1 + is-callable: 1.1.5 + is-regex: 1.0.5 + object-inspect: 1.7.0 + object-keys: 1.1.1 + object.assign: 4.1.0 + string.prototype.trimleft: 2.1.1 + string.prototype.trimright: 2.1.1 + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-yYkE07YF+6SIBmg1MsJ9dlub5L48Ek7X0qz+c/CPCHS9EBXfESorzng4cJQjJW5/pB6vDF41u7F8vUhLVDqIug== + /es-to-primitive/1.2.1: + dependencies: + is-callable: 1.1.5 + is-date-object: 1.0.2 + is-symbol: 1.0.3 + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== /es6-promise/4.2.8: dev: true resolution: @@ -1713,6 +1839,14 @@ packages: node: '>=4' resolution: integrity: sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + /find-up/3.0.0: + dependencies: + locate-path: 3.0.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== /find-up/4.1.0: dependencies: locate-path: 5.0.0 @@ -1730,6 +1864,13 @@ packages: node: '>=6' resolution: integrity: sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww== + /flat/4.1.0: + dependencies: + is-buffer: 2.0.4 + dev: true + hasBin: true + resolution: + integrity: sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw== /from2/2.3.0: dependencies: inherits: 2.0.4 @@ -1761,6 +1902,10 @@ packages: node: 6.* || 8.* || >= 10.* resolution: integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + /get-func-name/2.0.0: + dev: true + resolution: + integrity: sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= /get-stream/4.1.0: dependencies: pump: 3.0.0 @@ -1796,6 +1941,17 @@ packages: node: '>= 6' resolution: integrity: sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + /glob/7.1.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.0.4 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + resolution: + integrity: sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== /glob/7.1.6: dependencies: fs.realpath: 1.0.0 @@ -1832,6 +1988,12 @@ packages: dev: true resolution: integrity: sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + /growl/1.10.5: + dev: true + engines: + node: '>=4.x' + resolution: + integrity: sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== /handlebars/4.5.3: dependencies: neo-async: 2.6.1 @@ -1863,6 +2025,19 @@ packages: node: '>= 0.4' resolution: integrity: sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== + /has/1.0.3: + dependencies: + function-bind: 1.1.1 + dev: true + engines: + node: '>= 0.4.0' + resolution: + integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + /he/1.2.0: + dev: true + hasBin: true + resolution: + integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== /hook-std/2.0.0: dev: true engines: @@ -1972,12 +2147,36 @@ packages: dev: true resolution: integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + /is-buffer/2.0.4: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A== + /is-callable/1.1.5: + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q== + /is-date-object/1.0.2: + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== /is-extglob/2.1.1: dev: true engines: node: '>=0.10.0' resolution: integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + /is-fullwidth-code-point/2.0.0: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= /is-fullwidth-code-point/3.0.0: dev: true engines: @@ -2028,6 +2227,14 @@ packages: dev: true resolution: integrity: sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw== + /is-regex/1.0.5: + dependencies: + has: 1.0.3 + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ== /is-stream/1.1.0: dev: true engines: @@ -2040,6 +2247,14 @@ packages: node: '>=8' resolution: integrity: sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + /is-symbol/1.0.3: + dependencies: + has-symbols: 1.0.1 + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== /is-text-path/1.0.1: dependencies: text-extensions: 1.9.0 @@ -2099,6 +2314,14 @@ packages: dev: true resolution: integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + /js-yaml/3.13.1: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true + hasBin: true + resolution: + integrity: sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== /jsesc/0.5.0: dev: true hasBin: true @@ -2164,6 +2387,15 @@ packages: node: '>=4' resolution: integrity: sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + /locate-path/3.0.0: + dependencies: + p-locate: 3.0.0 + path-exists: 3.0.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== /locate-path/5.0.0: dependencies: p-locate: 4.1.0 @@ -2216,6 +2448,14 @@ packages: dev: true resolution: integrity: sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + /log-symbols/2.2.0: + dependencies: + chalk: 2.4.2 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== /loose-envify/1.4.0: dependencies: js-tokens: 4.0.0 @@ -2250,6 +2490,10 @@ packages: dev: true resolution: integrity: sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw== + /make-error/1.3.5: + dev: true + resolution: + integrity: sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== /map-obj/1.0.1: dev: true engines: @@ -2373,6 +2617,37 @@ packages: hasBin: true resolution: integrity: sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + /mocha/6.2.2: + dependencies: + ansi-colors: 3.2.3 + browser-stdout: 1.3.1 + debug: 3.2.6 + diff: 3.5.0 + escape-string-regexp: 1.0.5 + find-up: 3.0.0 + glob: 7.1.3 + growl: 1.10.5 + he: 1.2.0 + js-yaml: 3.13.1 + log-symbols: 2.2.0 + minimatch: 3.0.4 + mkdirp: 0.5.1 + ms: 2.1.1 + node-environment-flags: 1.0.5 + object.assign: 4.1.0 + strip-json-comments: 2.0.1 + supports-color: 6.0.0 + which: 1.3.1 + wide-align: 1.1.3 + yargs: 13.3.0 + yargs-parser: 13.1.1 + yargs-unparser: 1.6.0 + dev: true + engines: + node: '>= 6.0.0' + hasBin: true + resolution: + integrity: sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A== /modify-values/1.0.1: dev: true engines: @@ -2383,6 +2658,10 @@ packages: dev: true resolution: integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + /ms/2.1.1: + dev: true + resolution: + integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== /ms/2.1.2: dev: true resolution: @@ -2405,6 +2684,13 @@ packages: dev: true resolution: integrity: sha512-Yt3384If5H6BYGVHiHwTL+99OzJKHhgp82S8/dktEK73T26BazdgZ4JZh92xSVtGNJvz9UbXdNAc5hcrXV42vw== + /node-environment-flags/1.0.5: + dependencies: + object.getownpropertydescriptors: 2.1.0 + semver: 5.7.1 + dev: true + resolution: + integrity: sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== /node-fetch/2.6.0: dev: true engines: @@ -2577,6 +2863,10 @@ packages: hasBin: true resolution: integrity: sha512-vTcUL4SCg3AzwInWTbqg1OIaOXlzKSS8Mb8kc5avwrJpcvevDA5J9BhYSuei+fNs3pwOp4lzA5x2FVDXACvoXA== + /object-inspect/1.7.0: + dev: true + resolution: + integrity: sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== /object-keys/1.1.1: dev: true engines: @@ -2600,6 +2890,15 @@ packages: node: '>= 0.4' resolution: integrity: sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + /object.getownpropertydescriptors/2.1.0: + dependencies: + define-properties: 1.1.3 + es-abstract: 1.17.0 + dev: true + engines: + node: '>= 0.8' + resolution: + integrity: sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg== /octokit-pagination-methods/1.1.0: dev: true resolution: @@ -2684,6 +2983,14 @@ packages: node: '>=4' resolution: integrity: sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + /p-locate/3.0.0: + dependencies: + p-limit: 2.2.1 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== /p-locate/4.1.0: dependencies: p-limit: 2.2.1 @@ -2801,6 +3108,10 @@ packages: node: '>=8' resolution: integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + /pathval/1.1.0: + dev: true + resolution: + integrity: sha1-uULm1L3mUwBe9rcTYd74cn0GReA= /picomatch/2.1.1: dev: true engines: @@ -3262,6 +3573,10 @@ packages: dev: true resolution: integrity: sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw== + /sprintf-js/1.0.3: + dev: true + resolution: + integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= /stream-combiner2/1.1.1: dependencies: duplexer2: 0.1.4 @@ -3269,6 +3584,25 @@ packages: dev: true resolution: integrity: sha1-+02KFCDqNidk4hrUeAOXvry0HL4= + /string-width/2.1.1: + dependencies: + is-fullwidth-code-point: 2.0.0 + strip-ansi: 4.0.0 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + /string-width/3.1.0: + dependencies: + emoji-regex: 7.0.3 + is-fullwidth-code-point: 2.0.0 + strip-ansi: 5.2.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== /string-width/4.2.0: dependencies: emoji-regex: 8.0.0 @@ -3279,6 +3613,24 @@ packages: node: '>=8' resolution: integrity: sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + /string.prototype.trimleft/2.1.1: + dependencies: + define-properties: 1.1.3 + function-bind: 1.1.1 + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag== + /string.prototype.trimright/2.1.1: + dependencies: + define-properties: 1.1.3 + function-bind: 1.1.1 + dev: true + engines: + node: '>= 0.4' + resolution: + integrity: sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g== /string_decoder/1.1.1: dependencies: safe-buffer: 5.1.2 @@ -3291,6 +3643,22 @@ packages: dev: true resolution: integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + /strip-ansi/4.0.0: + dependencies: + ansi-regex: 3.0.0 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha1-qEeQIusaw2iocTibY1JixQXuNo8= + /strip-ansi/5.2.0: + dependencies: + ansi-regex: 4.1.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== /strip-ansi/6.0.0: dependencies: ansi-regex: 5.0.0 @@ -3337,6 +3705,14 @@ packages: node: '>=4' resolution: integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + /supports-color/6.0.0: + dependencies: + has-flag: 3.0.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg== /supports-color/6.1.0: dependencies: has-flag: 3.0.0 @@ -3434,9 +3810,31 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-n5up2e+odkw4dpi8v+sshI8RrbM= + /ts-node/8.5.4_typescript@3.7.4: + dependencies: + arg: 4.1.2 + diff: 4.0.1 + make-error: 1.3.5 + source-map-support: 0.5.16 + typescript: 3.7.4 + yn: 3.1.1 + dev: true + engines: + node: '>=4.2.0' + hasBin: true + peerDependencies: + typescript: '>=2.0' + resolution: + integrity: sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw== /tslib/1.10.0: resolution: integrity: sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + /type-detect/4.0.8: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== /type-fest/0.3.1: dev: true engines: @@ -3565,6 +3963,12 @@ packages: hasBin: true resolution: integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + /wide-align/1.1.3: + dependencies: + string-width: 2.1.1 + dev: true + resolution: + integrity: sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== /windows-release/3.2.0: dependencies: execa: 1.0.0 @@ -3579,6 +3983,16 @@ packages: node: '>=0.4.0' resolution: integrity: sha1-o9XabNXAvAAI03I0u68b7WMFkQc= + /wrap-ansi/5.1.0: + dependencies: + ansi-styles: 3.2.1 + string-width: 3.1.0 + strip-ansi: 5.2.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== /wrap-ansi/6.2.0: dependencies: ansi-styles: 4.2.0 @@ -3621,6 +4035,13 @@ packages: dev: true resolution: integrity: sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + /yargs-parser/13.1.1: + dependencies: + camelcase: 5.3.1 + decamelize: 1.2.0 + dev: true + resolution: + integrity: sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== /yargs-parser/16.1.0: dependencies: camelcase: 5.3.1 @@ -3628,6 +4049,31 @@ packages: dev: true resolution: integrity: sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg== + /yargs-unparser/1.6.0: + dependencies: + flat: 4.1.0 + lodash: 4.17.15 + yargs: 13.3.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw== + /yargs/13.3.0: + dependencies: + cliui: 5.0.0 + find-up: 3.0.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + require-main-filename: 2.0.0 + set-blocking: 2.0.0 + string-width: 3.1.0 + which-module: 2.0.0 + y18n: 4.0.0 + yargs-parser: 13.1.1 + dev: true + resolution: + integrity: sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== /yargs/15.0.2: dependencies: cliui: 6.0.0 @@ -3644,16 +4090,27 @@ packages: dev: true resolution: integrity: sha512-GH/X/hYt+x5hOat4LMnCqMd8r5Cv78heOMIJn1hr7QPPBqfeC6p89Y78+WB9yGDvfpCvgasfmWLzNzEioOUD9Q== + /yn/3.1.1: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== specifiers: '@rollup/plugin-commonjs': ^11.0.0 '@rollup/plugin-node-resolve': ^6.0.0 '@thi.ng/compose': ^1.3.6 + '@types/chai': ^4.2.7 + '@types/mocha': ^5.2.7 '@types/node': ^12.12.21 '@wessberg/rollup-plugin-ts': ^1.1.83 + chai: ^4.2.0 + mocha: ^6.2.2 rimraf: ^3.0.0 rollup: ^1.27.14 rollup-plugin-terser: ^5.1.3 semantic-release: ^15.14.0 + ts-node: ^8.5.4 tslib: ^1.10.0 typescript: ^3.7.4 utility-types: ^3.10.0 diff --git a/typescript/option/src/helpers/bind.test.ts b/typescript/option/src/helpers/bind.test.ts new file mode 100644 index 0000000..d20ca4f --- /dev/null +++ b/typescript/option/src/helpers/bind.test.ts @@ -0,0 +1,32 @@ +import { expect } from 'chai' +import { bind } from './bind' +import { Some, None } from '../types' +import { constantly } from '@thi.ng/compose' + +describe('The bind helper', () => { + it('should return none for any callback when given None', () => { + // act + const result = bind(Some, None) + + // assert + expect(result).to.equal(None) + }) + + describe('When given Some', () => { + it('should return None if the callback returns None', () => { + // act + const result = bind(constantly(None), Some(3)) + + // assert + expect(result).to.equal(None) + }) + + it('should return Some if the callback returns Some', () => { + // act + const result = bind(x => Some(x + 1), Some(3)) + + // assert + expect(result).to.equal(Some(4)) + }) + }) +}) diff --git a/typescript/option/tsconfig.json b/typescript/option/tsconfig.json index ee2ac52..fe39ee0 100644 --- a/typescript/option/tsconfig.json +++ b/typescript/option/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "module": "CommonJS", "lib": ["esnext", "dom", "es2015.iterable"], "moduleResolution": "node", "strictNullChecks": true,