diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/changelog node-es6-symbol-3.1.3+~cs3.11.0/debian/changelog --- node-es6-symbol-3.1.3+~cs3.5.0/debian/changelog 2020-11-11 07:57:29.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/changelog 2021-12-28 19:34:23.000000000 +0000 @@ -1,3 +1,17 @@ +node-es6-symbol (3.1.3+~cs3.11.0-1) unstable; urgency=medium + + * Team upload + * Add ctype=nodejs to component(s) + * Fix GitHub tags regex + * Update standards version to 4.6.0, no changes needed. + * Fix filenamemangle + * New upstream version 3.1.3+~cs3.11.0, updates: + + ext 1.6.0 + + type 2.5.0 + * Update test + + -- Yadd Tue, 28 Dec 2021 20:34:23 +0100 + node-es6-symbol (3.1.3+~cs3.5.0-1) unstable; urgency=medium * Team upload diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/control node-es6-symbol-3.1.3+~cs3.11.0/debian/control --- node-es6-symbol-3.1.3+~cs3.5.0/debian/control 2020-11-11 07:57:29.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/control 2021-12-28 19:20:54.000000000 +0000 @@ -9,7 +9,7 @@ , mocha , node-d , node-sinon -Standards-Version: 4.5.0 +Standards-Version: 4.6.0 Vcs-Browser: https://salsa.debian.org/js-team/node-es6-symbol Vcs-Git: https://salsa.debian.org/js-team/node-es6-symbol.git Homepage: https://github.com/medikoo/es6-symbol diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/copyright node-es6-symbol-3.1.3+~cs3.11.0/debian/copyright --- node-es6-symbol-3.1.3+~cs3.5.0/debian/copyright 2020-11-11 07:53:02.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/copyright 2021-12-28 19:32:15.000000000 +0000 @@ -11,9 +11,13 @@ Files: debian/* Copyright: 2017 Pirate Praveen - 2020 Xavier Guimard + 2020 Yadd License: Expat +Files: debian/tests/test_modules/timers-ext/* +Copyright: 2013-2018 Mariusz Nowak, @medikoo, medikoo.com +License: ISC + License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -34,3 +38,16 @@ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License: ISC + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/nodejs/type/test node-es6-symbol-3.1.3+~cs3.11.0/debian/nodejs/type/test --- node-es6-symbol-3.1.3+~cs3.5.0/debian/nodejs/type/test 2020-11-11 07:54:04.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/nodejs/type/test 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -mocha --recursive diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/delay.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/delay.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/delay.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/delay.js 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,21 @@ +"use strict"; + +var callable = require("es5-ext/object/valid-callable") + , nextTick = require("next-tick") + , validTimeout = require("./valid-timeout"); + +var apply = Function.prototype.apply; + +module.exports = function (fn/*, timeout*/) { + var delay, timeout = arguments[1]; + callable(fn); + if (timeout === undefined) { + delay = nextTick; + } else { + timeout = validTimeout(timeout); + delay = setTimeout; + } + return function () { + return delay(apply.bind(fn, this, arguments), timeout); + }; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/max-timeout.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/max-timeout.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/max-timeout.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/max-timeout.js 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = 2147483647; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/once.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/once.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/once.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/once.js 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,42 @@ +// It's actually "debounce" + +"use strict"; + +var isValue = require("es5-ext/object/is-value") + , callable = require("es5-ext/object/valid-callable") + , nextTick = require("next-tick") + , validTimeout = require("./valid-timeout"); + +var apply = Function.prototype.apply; + +module.exports = function (fn/*, timeout*/) { + var scheduled, run, context, args, delay, timeout = arguments[1], handle; + callable(fn); + if (isValue(timeout)) { + timeout = validTimeout(timeout); + delay = setTimeout; + } else { + delay = nextTick; + } + run = function () { + if (!scheduled) return; // IE8 tends to not clear immediate timeouts properly + scheduled = false; + handle = null; + apply.call(fn, context, args); + context = null; + args = null; + }; + return function () { + if (scheduled) { + if (!isValue(handle)) { + // 'nextTick' based, no room for debounce + return; + } + clearTimeout(handle); + } + scheduled = true; + context = this; + args = arguments; + handle = delay(run, timeout); + }; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/package.json node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/package.json --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/package.json 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/package.json 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,42 @@ +{ + "name": "timers-ext", + "version": "0.1.7", + "description": "Timers extensions", + "author": "Mariusz Nowak (http://www.medikoo.com/)", + "repository": { + "type": "git", + "url": "git://github.com/medikoo/timers-ext.git" + }, + "keywords": [ + "timeout", + "delay", + "interval", + "time", + "timer", + "timers" + ], + "dependencies": { + "es5-ext": "~0.10.46", + "next-tick": "1" + }, + "devDependencies": { + "eslint": "^5.6.1", + "eslint-config-medikoo-es5": "^1.7.2", + "tad": "^0.2.8" + }, + "eslintConfig": { + "extends": "medikoo-es5", + "root": true, + "globals": { + "clearInterval": true, + "clearTimeout": true, + "setInterval": true, + "setTimeout": true + } + }, + "scripts": { + "lint": "eslint --ignore-path=.gitignore .", + "test": "node node_modules/tad/bin/tad" + }, + "license": "ISC" +} diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/promise/sleep.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/promise/sleep.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/promise/sleep.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/promise/sleep.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,21 @@ +"use strict"; + +var isValue = require("es5-ext/object/is-value") + , isPromise = require("es5-ext/object/is-promise") + , nextTick = require("next-tick") + , ensureTimeout = require("../valid-timeout"); + +module.exports = function (/* timeout */) { + var Constructor = isPromise(this) ? this.constructor : Promise; + var timeout = arguments[0]; + if (isValue(timeout)) timeout = ensureTimeout(timeout); + return new Constructor(function (resolve) { + if (isValue(timeout)) { + setTimeout(function () { + resolve(); + }, timeout); + } else { + nextTick(resolve); + } + }); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/promise_/timeout.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/promise_/timeout.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/promise_/timeout.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/promise_/timeout.js 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,43 @@ +"use strict"; + +var customError = require("es5-ext/error/custom") + , isValue = require("es5-ext/object/is-value") + , ensurePromise = require("es5-ext/object/ensure-promise") + , nextTick = require("next-tick") + , ensureTimeout = require("../valid-timeout"); + +module.exports = function (/* timeout */) { + ensurePromise(this); + var timeout = arguments[0]; + if (isValue(timeout)) timeout = ensureTimeout(timeout); + return new this.constructor( + function (resolve, reject) { + var isSettled = false, timeoutId; + var timeoutCallback = function () { + if (isSettled) return; + reject( + customError( + "Operation timeout (exceeded " + + (isValue(timeout) ? timeout + "ms" : "tick") + + ")", + "PROMISE_TIMEOUT" + ) + ); + }; + if (isValue(timeout)) timeoutId = setTimeout(timeoutCallback, timeout); + else nextTick(timeoutCallback); + this.then( + function (value) { + isSettled = true; + clearTimeout(timeoutId); + resolve(value); + }, + function (reason) { + isSettled = true; + clearTimeout(timeoutId); + reject(reason); + } + ); + }.bind(this) + ); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/delay.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/delay.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/delay.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/delay.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,27 @@ +"use strict"; + +module.exports = function (t, a, d) { + var data + , count = 0 + , x = function (a, b, c) { + data = [this, a, b, c, ++count]; + } + , y = t(x, 200) + , z = {}; + + a(data, undefined, "Setup"); + y.call(z, 111, "foo", false); + a(data, undefined, "Immediately"); + setTimeout(function () { + a(data, undefined, "100ms"); + setTimeout(function () { + a.deep(data, [z, 111, "foo", false, 1], "250ms"); + data = null; + clearTimeout(y()); + setTimeout(function () { + a(data, null, "Clear"); + d(); + }, 300); + }, 150); + }, 100); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/max-timeout.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/max-timeout.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/max-timeout.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/max-timeout.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,13 @@ +"use strict"; + +module.exports = function (t, a, d) { + var invoked, id; + id = setTimeout(function () { + invoked = true; +}, t); + setTimeout(function () { + a(invoked, undefined); + clearTimeout(id); + d(); + }, 100); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/once.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/once.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/once.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/once.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,42 @@ +"use strict"; + +module.exports = function (t, a, d) { + var called = 0, fn = t(function () { + ++called; +}); + + fn(); + fn(); + fn(); + setTimeout(function () { + a(called, 1); + + called = 0; + fn = t(function () { + ++called; +}, 50); + fn(); + fn(); + fn(); + + setTimeout(function () { + fn(); + fn(); + + setTimeout(function () { + fn(); + fn(); + + setTimeout(function () { + fn(); + fn(); + + setTimeout(function () { + a(called, 1); + d(); + }, 70); + }, 30); + }, 30); + }, 30); + }, 10); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/promise/sleep.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/promise/sleep.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/promise/sleep.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/promise/sleep.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,34 @@ +"use strict"; + +var delay = require("../../delay"); + +module.exports = function (t, a) { + if (typeof Promise !== "function") return null; + return { + Tick: function (d) { + var isInvoked = false; + t().then(function (result) { + isInvoked = true; + delay(function () { + a(result, undefined); + d(); + })(); + }, delay(d)); + a(isInvoked, false); + }, + Timeout: function (d) { + var isInvoked = false; + t(100).then( + delay(function (result) { + isInvoked = true; + a(result, undefined); + d(); + }), + delay(d) + ); + setTimeout(function () { + a(isInvoked, false); + }, 50); + } + }; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/promise_/timeout.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/promise_/timeout.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/promise_/timeout.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/promise_/timeout.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,46 @@ +"use strict"; + +var delay = require("../../delay"); + +module.exports = function (t, a) { + if (typeof Promise !== "function") return null; + return { + Success: function (d) { + var promise = t.call( + new Promise(function (resolve) { + setTimeout(function () { resolve("foo"); }, 20); + }), + 40 + ); + + promise.then( + // Delay to escape error swallowing + delay(function (result) { + a(result, "foo"); + d(); + }), + delay(d) + ); + }, + Timeout: function (d) { + var promise = t.call( + new Promise(function (resolve) { + setTimeout(function () { resolve("foo"); }, 40); + }), + 20 + ); + + promise.then( + // Delay to escape error swallowing + delay(function () { + a.never(); + d(); + }), + delay(function (err) { + a(err.code, "PROMISE_TIMEOUT"); + d(); + }) + ); + } + }; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/throttle.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/throttle.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/throttle.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/throttle.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,41 @@ +"use strict"; + +module.exports = function (t, a, d) { + var called = 0; + var fn = t(function () { + ++called; + }, 200); + + fn(); + a(called, 1); + fn(); + fn(); + a(called, 1); + // Wait 120ms + setTimeout(function () { + a(called, 1); + fn(); + // Wait 120ms + setTimeout(function () { + a(called, 2); + fn(); + fn(); + + // Wait 80ms + setTimeout(function () { + a(called, 2); + + // Wait 120ms + setTimeout(function () { + a(called, 3); + + // Wait 400ms + setTimeout(function () { + a(called, 3); + d(); + }, 400); + }, 120); + }, 80); + }, 120); + }, 120); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/valid-timeout.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/valid-timeout.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/test/valid-timeout.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/test/valid-timeout.js 2021-12-28 19:27:34.000000000 +0000 @@ -0,0 +1,10 @@ +"use strict"; + +module.exports = function (t, a) { + a(t(NaN), 0, "NaN"); + a(t(-343), 0, "Negative"); + a(t(232342), 232342, "Positive"); + a.throws(function () { + t(1e23); +}, TypeError, "Too large"); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/throttle.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/throttle.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/throttle.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/throttle.js 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,33 @@ +"use strict"; + +var callable = require("es5-ext/object/valid-callable") + , validTimeout = require("./valid-timeout") + + , apply = Function.prototype.apply; + +module.exports = function (fn, timeout) { + var isScheduled = false, context, args, run; + callable(fn); + timeout = validTimeout(timeout); + run = function () { + var currentContext = context, currentArgs = args; + if (!args) { + isScheduled = false; + return; + } + context = null; + args = null; + setTimeout(run, timeout); + apply.call(fn, currentContext, currentArgs); + }; + return function () { + if (isScheduled) { + context = this; + args = arguments; + return; + } + isScheduled = true; + setTimeout(run, timeout); + apply.call(fn, this, arguments); + }; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/valid-timeout.js node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/valid-timeout.js --- node-es6-symbol-3.1.3+~cs3.5.0/debian/tests/test_modules/timers-ext/valid-timeout.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/tests/test_modules/timers-ext/valid-timeout.js 2021-12-28 19:27:33.000000000 +0000 @@ -0,0 +1,10 @@ +"use strict"; + +var toPosInt = require("es5-ext/number/to-pos-integer") + , maxTimeout = require("./max-timeout"); + +module.exports = function (value) { + value = toPosInt(value); + if (value > maxTimeout) throw new TypeError(value + " exceeds maximum possible timeout"); + return value; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/debian/watch node-es6-symbol-3.1.3+~cs3.11.0/debian/watch --- node-es6-symbol-3.1.3+~cs3.5.0/debian/watch 2020-11-11 07:49:13.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/debian/watch 2021-12-28 19:20:54.000000000 +0000 @@ -1,15 +1,15 @@ version=4 opts=\ dversionmangle=auto,\ -filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/node-es6-symbol-$1.tar.gz/ \ - https://github.com/medikoo/es6-symbol/tags .*/archive/v?([\d\.]+).tar.gz group +filenamemangle=s/.*?(\d[\d\.-]*@ARCHIVE_EXT@)/node-es6-symbol-$1/ \ + https://github.com/medikoo/es6-symbol/tags .*/archive/.*/v?([\d\.]+).tar.gz group # It is not recommended use npmregistry. Please investigate more. # Take a look at https://wiki.debian.org/debian/watch/ -opts="searchmode=plain,component=ext,pgpmode=none" \ +opts="searchmode=plain,ctype=nodejs,component=ext,pgpmode=none" \ https://registry.npmjs.org/ext https://registry.npmjs.org/ext/-/ext-([\d\.]+)@ARCHIVE_EXT@ checksum # It is not recommended use npmregistry. Please investigate more. # Take a look at https://wiki.debian.org/debian/watch/ -opts="searchmode=plain,component=type,pgpmode=none" \ +opts="searchmode=plain,ctype=nodejs,component=type,pgpmode=none" \ https://registry.npmjs.org/type https://registry.npmjs.org/type/-/type-([\d\.]+)@ARCHIVE_EXT@ checksum diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/CHANGELOG.md node-es6-symbol-3.1.3+~cs3.11.0/ext/CHANGELOG.md --- node-es6-symbol-3.1.3+~cs3.5.0/ext/CHANGELOG.md 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/CHANGELOG.md 1985-10-26 08:15:00.000000000 +0000 @@ -2,6 +2,24 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.6.0](https://github.com/medikoo/es5-ext/compare/v1.5.0...v1.6.0) (2021-09-24) + +### Features + +- `Object.clear` util ([a955da4](https://github.com/medikoo/es5-ext/commit/a955da41e65a25ad87a46234bae065f096abd1d2)) + +### Bug Fixes + +- Fix `Object.entries` to not return non enumerable properties ([44fb872](https://github.com/medikoo/es5-ext/commit/44fb87266617378d2f47a1a5baad6280bf6298a8)) + +## [1.5.0](https://github.com/medikoo/es5-ext/compare/v1.3.0...v1.5.0) (2021-08-23) + +### Features + +- `Promise.limit` ([060a05d](https://github.com/medikoo/es5-ext/commit/060a05d4751cd291c6dd7641f5a73ba9338ea7ab)) +- `String.prototype.includes` ([ceebe8d](https://github.com/medikoo/es5-ext/commit/ceebe8dfd6f479d6a7e7b6cd79369291869ee2dd)) +- `charset` option for `String.random` ([2a20eeb](https://github.com/medikoo/es5-ext/commit/2a20eebc5ae784e5c1aacd2c54433fe92a9464c9)) + ## [1.4.0](https://github.com///compare/v1.3.0...v1.4.0) (2019-11-29) ### Features diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/docs/object/clear.md node-es6-symbol-3.1.3+~cs3.11.0/ext/docs/object/clear.md --- node-es6-symbol-3.1.3+~cs3.5.0/ext/docs/object/clear.md 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/docs/object/clear.md 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,12 @@ +# `Object.clear` _(ext/object/clear)_ + +Deletes all own, enumerable, non-symbol properties in the object + +```javascript +const clear = require("ext/object/clear"); + +const obj = { foo: "bar" }; + +clear(obj); +Object.keys(obj); // [] +``` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/docs/promise/limit.md node-es6-symbol-3.1.3+~cs3.11.0/ext/docs/promise/limit.md --- node-es6-symbol-3.1.3+~cs3.5.0/ext/docs/promise/limit.md 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/docs/promise/limit.md 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,13 @@ +# `Promise.limit` _(ext/promise/limit)_ + +Helps to limit concurrency of asynchronous operations. + +```javascript +const limit = require("ext/promise/limit").bind(Promise); + +const limittedAsyncFunction = limit(2, asyncFunction); + +imittedAsyncFunction(); // Async operation started +imittedAsyncFunction(); // Async operation started +imittedAsyncFunction(); // On hold until one of previously started finalizes +``` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/.github/FUNDING.yml node-es6-symbol-3.1.3+~cs3.11.0/ext/.github/FUNDING.yml --- node-es6-symbol-3.1.3+~cs3.5.0/ext/.github/FUNDING.yml 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/.github/FUNDING.yml 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1 @@ +github: medikoo diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/lib/private/define-function-length.js node-es6-symbol-3.1.3+~cs3.11.0/ext/lib/private/define-function-length.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/lib/private/define-function-length.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/lib/private/define-function-length.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,56 @@ +"use strict"; + +var test = function (arg1, arg2) { return arg2; }; + +try { + Object.defineProperty(test, "length", { + configurable: true, + writable: false, + enumerable: false, + value: 1 + }); +} +catch (ignore) {} + +if (test.length === 1) { + // ES2015+ + var desc = { configurable: true, writable: false, enumerable: false }; + module.exports = function (length, fn) { + if (fn.length === length) return fn; + desc.value = length; + return Object.defineProperty(fn, "length", desc); + }; + return; +} + +module.exports = function (length, fn) { + if (fn.length === length) return fn; + switch (length) { + case 0: + return function () { return fn.apply(this, arguments); }; + case 1: + return function (ignored1) { return fn.apply(this, arguments); }; + case 2: + return function (ignored1, ignored2) { return fn.apply(this, arguments); }; + case 3: + return function (ignored1, ignored2, ignored3) { return fn.apply(this, arguments); }; + case 4: + return function (ignored1, ignored2, ignored3, ignored4) { + return fn.apply(this, arguments); + }; + case 5: + return function (ignored1, ignored2, ignored3, ignored4, ignored5) { + return fn.apply(this, arguments); + }; + case 6: + return function (ignored1, ignored2, ignored3, ignored4, ignored5, ignored6) { + return fn.apply(this, arguments); + }; + case 7: + return function (ignored1, ignored2, ignored3, ignored4, ignored5, ignored6, ignored7) { + return fn.apply(this, arguments); + }; + default: + throw new Error("Usupported function length"); + } +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/object/clear.js node-es6-symbol-3.1.3+~cs3.11.0/ext/object/clear.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/object/clear.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/object/clear.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,15 @@ +"use strict"; + +var ensureObject = require("type/object/ensure") + , ensure = require("type/ensure"); + +var objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable; + +module.exports = function (object) { + ensure(["object", object, ensureObject]); + for (var key in object) { + if (!objPropertyIsEnumerable.call(object, key)) continue; + delete object[key]; + } + return object; +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/object/entries/implementation.js node-es6-symbol-3.1.3+~cs3.11.0/ext/object/entries/implementation.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/object/entries/implementation.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/object/entries/implementation.js 1985-10-26 08:15:00.000000000 +0000 @@ -2,13 +2,13 @@ var ensureValue = require("type/value/ensure"); -var objHasOwnProperty = Object.prototype.hasOwnProperty; +var objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable; module.exports = function (object) { object = Object(ensureValue(object)); var result = []; for (var key in object) { - if (!objHasOwnProperty.call(object, key)) continue; + if (!objPropertyIsEnumerable.call(object, key)) continue; result.push([key, object[key]]); } return result; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/package.json node-es6-symbol-3.1.3+~cs3.11.0/ext/package.json --- node-es6-symbol-3.1.3+~cs3.5.0/ext/package.json 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/package.json 1985-10-26 08:15:00.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "ext", - "version": "1.4.0", + "version": "1.6.0", "description": "JavaScript utilities with respect to emerging standard", "author": "Mariusz Nowak (http://www.medikoo.com/)", "keywords": [ @@ -22,21 +22,22 @@ ], "repository": { "type": "git", - "url": "https://github.com/medikoo/es5-ext/tree/ext" + "url": "https://github.com/medikoo/es5-ext#ext" }, "dependencies": { - "type": "^2.0.0" + "type": "^2.5.0" }, "devDependencies": { - "chai": "^4.2.0", - "eslint": "^6.7.1", - "eslint-config-medikoo": "^2.7.0", + "chai": "^4.3.4", + "eslint": "^7.32.0", + "eslint-config-medikoo": "^4.1.0", "git-list-updated": "^1.2.1", - "husky": "^3.1.0", - "lint-staged": "^9.5.0", - "mocha": "^6.2.2", - "prettier-elastic": "^1.18.2", - "sinon": "^7.5.0" + "husky": "^4.3.8", + "lint-staged": "^11.1.2", + "mocha": "^6.2.3", + "prettier-elastic": "^2.2.1", + "sinon": "^8.1.1", + "timers-ext": "^0.1.7" }, "husky": { "hooks": { @@ -52,7 +53,7 @@ ] }, "eslintIgnore": [ - "_es5-ext/*" + "_es5-ext" ], "eslintConfig": { "extends": "medikoo/es3", @@ -86,7 +87,10 @@ } }, { - "files": "test/thenable_/finally.js", + "files": [ + "test/promise/limit.js", + "test/thenable_/finally.js" + ], "globals": { "Promise": true } diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/promise/limit.js node-es6-symbol-3.1.3+~cs3.11.0/ext/promise/limit.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/promise/limit.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/promise/limit.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,62 @@ +"use strict"; + +var ensureNaturalNumber = require("type/natural-number/ensure") + , ensurePlainFunction = require("type/plain-function/ensure") + , ensure = require("type/ensure") + , defineFunctionLength = require("../lib/private/define-function-length"); + +module.exports = function (limit, callback) { + limit = ensure( + ["limit", limit, ensureNaturalNumber, { min: 1 }], + ["callback", callback, ensurePlainFunction] + )[0]; + + var Promise = this, ongoingCount = 0, pending = []; + var onSuccess, onFailure; + + var release = function () { + --ongoingCount; + if (ongoingCount >= limit) return; + var next = pending.shift(); + if (!next) return; + ++ongoingCount; + try { + next.resolve( + Promise.resolve(callback.apply(next.context, next.arguments)).then( + onSuccess, onFailure + ) + ); + } catch (exception) { + release(); + next.reject(exception); + } + }; + + onSuccess = function (value) { + release(); + return value; + }; + + onFailure = function (exception) { + release(); + throw exception; + }; + + return defineFunctionLength(callback.length, function () { + if (ongoingCount >= limit) { + var context = this, args = arguments; + return new Promise(function (resolve, reject) { + pending.push({ + context: context, + arguments: args, + resolve: resolve, + reject: reject + }); + }); + } + ++ongoingCount; + try { + return Promise.resolve(callback.apply(this, arguments)).then(onSuccess, onFailure); + } catch (exception) { return onFailure(exception); } + }); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/README.md node-es6-symbol-3.1.3+~cs3.11.0/ext/README.md --- node-es6-symbol-3.1.3+~cs3.5.0/ext/README.md 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/README.md 1985-10-26 08:15:00.000000000 +0000 @@ -24,7 +24,10 @@ - [`floor10`](docs/math/floor-10.md) - [`round10`](docs/math/round-10.md) - `Object` + - [`clear`](docs/object/clear.md) - [`entries`](docs/object/entries.md) +- `Promise` + - [`limit`](docs/promise/limit.md) - `String` - [`random`](docs/string/random.md) - `String.prototype` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/test/object/clear.js node-es6-symbol-3.1.3+~cs3.11.0/ext/test/object/clear.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/test/object/clear.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/test/object/clear.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,26 @@ +"use strict"; + +var assert = require("chai").assert + , clear = require("../../object/clear"); + +describe("object/clear", function () { + it("Should clear enumerable properties", function () { + var obj = { foo: "bar", elo: "sfds" }; + clear(obj); + // eslint-disable-next-line no-unreachable-loop + for (var key in obj) throw new Error("Unexpected" + key); + }); + it("Should return input object", function () { + var obj = {}; + assert.equal(clear(obj), obj); + }); + if (Object.defineProperty && Object.keys) { + it("Should keep non enumerable properties", function () { + var obj = { foo: "bar", elo: "sfds" }; + Object.defineProperty(obj, "hidden", { value: "some" }); + clear(obj); + assert.deepEqual(Object.keys(obj), []); + assert.equal(obj.hidden, "some"); + }); + } +}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/test/object/entries/_tests.js node-es6-symbol-3.1.3+~cs3.11.0/ext/test/object/entries/_tests.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/test/object/entries/_tests.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/test/object/entries/_tests.js 1985-10-26 08:15:00.000000000 +0000 @@ -6,8 +6,17 @@ it("Should resolve entries array for an object", function () { assert.deepEqual(entries({ foo: "bar" }), [["foo", "bar"]]); }); + if (Object.defineProperty) { + it("Should not resolve non-enumerable properties", function () { + var obj = { visible: true }; + Object.defineProperty(obj, "hidden", { value: "elo" }); + assert.deepEqual(entries(obj), [["visible", true]]); + }); + } it("Should resolve entries array for a primitive", function () { - assert.deepEqual(entries("raz"), [["0", "r"], ["1", "a"], ["2", "z"]]); + assert.deepEqual(entries("raz"), [ + ["0", "r"], ["1", "a"], ["2", "z"] + ]); }); it("Should throw on non-value", function () { assert["throws"](function () { entries(null); }, TypeError); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/ext/test/promise/limit.js node-es6-symbol-3.1.3+~cs3.11.0/ext/test/promise/limit.js --- node-es6-symbol-3.1.3+~cs3.5.0/ext/test/promise/limit.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/ext/test/promise/limit.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,52 @@ +"use strict"; + +var assert = require("chai").assert + , wait = require("timers-ext/promise/sleep") + , limit = require("../../promise/limit").bind(Promise); + +describe("promise/limit", function () { + it("Should limit executions", function () { + var count = 0; + var callCount = 0; + var limited = limit(2, function (arg1) { + var id = ++count; + assert.equal(arg1, "foo"); + assert.equal(arguments[1], id); + return wait(10).then(function () { return id; }); + }); + limited("foo", ++callCount); + assert.equal(count, 1); + limited("foo", ++callCount); + assert.equal(count, 2); + limited("foo", ++callCount); + assert.equal(count, 2); + limited("foo", ++callCount); + assert.equal(count, 2); + return wait(25).then(function () { + assert.equal(count, 4); + limited("foo", ++callCount); + assert.equal(count, 5); + limited("foo", ++callCount); + assert.equal(count, 6); + limited("foo", ++callCount); + assert.equal(count, 6); + return wait(25).then(function () { assert.equal(count, 7); }); + }); + }); + + it("Should resolve with expected result", function () { + var count = 0; + var limited = limit(2, function () { + var id = ++count; + return wait(10).then(function () { return id; }); + }); + limited(); + assert.equal(count, 1); + limited(); + assert.equal(count, 2); + return limited().then(function (result) { + assert.equal(result, 3); + limited().then(function (result) { assert.equal(result, 4); }); + }); + }); +}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/array/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/array/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/array/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/array/ensure.js 1985-10-26 08:15:00.000000000 +0000 @@ -1,12 +1,43 @@ "use strict"; -var resolveException = require("../lib/resolve-exception") - , is = require("./is"); +var resolveException = require("../lib/resolve-exception") + , resolveErrorMessage = require("../lib/resolve-error-message") + , toShortString = require("../lib/to-short-string") + , ensurePlainFunction = require("../plain-function/ensure") + , is = require("./is"); -module.exports = function (value/*, options*/) { - if (is(value)) return value; +var objHasOwnProperty = Object.prototype.hasOwnProperty, invalidItemsLimit = 3; + +module.exports = function (value /*, options*/) { var options = arguments[1]; - var errorMessage = + var mainErrorMessage = options && options.name ? "Expected an array for %n, received %v" : "%v is not an array"; - return resolveException(value, errorMessage, options); + if (!is(value)) return resolveException(value, mainErrorMessage, options); + if (!options) return value; + + var ensureItem = ensurePlainFunction(options.ensureItem, { isOptional: true }); + if (ensureItem) { + var coercedValue = [], invalidItems; + for (var index = 0, length = value.length; index < length; ++index) { + if (!objHasOwnProperty.call(value, index)) continue; + var coercedItem; + try { + coercedItem = ensureItem(value[index]); + } catch (error) { + if (!invalidItems) invalidItems = []; + if (invalidItems.push(toShortString(value[index])) === invalidItemsLimit) break; + } + if (invalidItems) continue; + coercedValue[index] = coercedItem; + } + if (invalidItems) { + throw new TypeError( + resolveErrorMessage(mainErrorMessage, value, options) + + ".\n Following items are invalid: " + + invalidItems.join(", ") + ); + } + return coercedValue; + } + return value; }; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/CHANGELOG.md node-es6-symbol-3.1.3+~cs3.11.0/type/CHANGELOG.md --- node-es6-symbol-3.1.3+~cs3.5.0/type/CHANGELOG.md 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/CHANGELOG.md 1985-10-26 08:15:00.000000000 +0000 @@ -2,6 +2,30 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.5.0](https://github.com/medikoo/type/compare/v2.4.0...v2.5.0) (2021-03-08) + +### Features + +- `errorCode` option for `ensure*` utils ([777a1f2](https://github.com/medikoo/type/commit/777a1f2c9fd76defcd24d3a30cce49491947fef7)) + +## [2.4.0](https://github.com/medikoo/type/compare/v2.3.0...v2.4.0) (2021-03-08) + +### Features + +- `set/is` and `set/ensure` utils ([083ec23](https://github.com/medikoo/type/commit/083ec2351718c310f316dcfd8c624a13201e227f)) + +## [2.3.0](https://github.com/medikoo/type/compare/v2.2.0...v2.3.0) (2021-02-16) + +### Features + +- `map/is` and `map/ensure` utils ([aafd1cb](https://github.com/medikoo/type/commit/aafd1cbd8c888fda98d39fd17e59f38b078d7bcf)) + +## [2.2.0](https://github.com/medikoo/type/compare/v2.1.0...v2.2.0) (2021-02-11) + +### Features + +- Support `ensureItem` option in `array/ensure` ([8f74973](https://github.com/medikoo/type/commit/8f749739df9bfebf44087093e09c8f7341a33a09)) + ## [2.1.0](https://github.com/medikoo/type/compare/v2.0.0...v2.1.0) (2020-08-21) ### Features diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/docs/array-length.md node-es6-symbol-3.1.3+~cs3.11.0/type/docs/array-length.md --- node-es6-symbol-3.1.3+~cs3.5.0/type/docs/array-length.md 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/docs/array-length.md 1985-10-26 08:15:00.000000000 +0000 @@ -23,5 +23,5 @@ const ensureArrayLength = require("type/array-length/ensure"); ensureArrayLength(12.93); // "12" -ensureArrayLength(9007199254740992); // Thrown TypeError: null is not a valid array length +ensureArrayLength(9007199254740992); // Thrown TypeError: 9007199254740992 is not a valid array length ``` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/docs/array.md node-es6-symbol-3.1.3+~cs3.11.0/type/docs/array.md --- node-es6-symbol-3.1.3+~cs3.5.0/type/docs/array.md 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/docs/array.md 1985-10-26 08:15:00.000000000 +0000 @@ -24,3 +24,23 @@ ensureArray(["foo"]); // ["foo"] ensureArray("foo"); // Thrown TypeError: foo is not an array ``` + +### Confirming on items + +Items can be validated by passing `ensureItem` option. Note that in this case: + +- A newly created instance of an array with coerced item values is returned +- Error message lists up to three items which are invalid + +```javascript +const ensureString = require("type/string/ensure"); + +ensureArray([12], { ensureItem: ensureString }); // ["12"] + +/* + Below invocation with crash with: + TypeError: 23, [object Object], [object Object] is not a valid array. + Following items are invalid: [object Object], [object Object] +*/ +ensureArray([23, {}, {}], { ensureItem: ensureString }); +``` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/docs/map.md node-es6-symbol-3.1.3+~cs3.11.0/type/docs/map.md --- node-es6-symbol-3.1.3+~cs3.5.0/type/docs/map.md 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/docs/map.md 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,27 @@ +# Map + +_Map_ instance + +## `map/is` + +Confirms if given object is a native _map_ + +```javascript +const isMap = require("type/map/is"); + +isMap(new Map()); // true +isMap(new Set()); // false +isMap({}); // false +``` + +## `map/ensure` + +If given argument is a _map_, it is returned back. Otherwise `TypeError` is thrown. + +```javascript +const ensureMap = require("type/map/ensure"); + +const map = new Map(); +ensureMap(map); // map +eensureMap({}); // Thrown TypeError: [object Object] is not a map +``` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/docs/set.md node-es6-symbol-3.1.3+~cs3.11.0/type/docs/set.md --- node-es6-symbol-3.1.3+~cs3.5.0/type/docs/set.md 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/docs/set.md 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,27 @@ +# Set + +_Set_ instance + +## `set/is` + +Confirms if given object is a native set\_ + +```javascript +const isSet = require("type/set/is"); + +isSet(new Set()); // true +isSet(new Set()); // false +isSet({}); // false +``` + +## `Set/ensure` + +If given argument is a _set_, it is returned back. Otherwise `TypeError` is thrown. + +```javascript +const ensureSet = require("type/set/ensure"); + +const set = new Set(); +ensureSet(set); // set +eensureSet({}); // Thrown TypeError: [object Object] is not a set +``` diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/.editorconfig node-es6-symbol-3.1.3+~cs3.11.0/type/.editorconfig --- node-es6-symbol-3.1.3+~cs3.5.0/type/.editorconfig 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/.editorconfig 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# EditorConfig is awesome: http://EditorConfig.org - -# top-most EditorConfig file -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -indent_style = tab -trim_trailing_whitespace = true - -[*.md] -indent_size = 2 -indent_style = space -trim_trailing_whitespace = false diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/lib/resolve-exception.js node-es6-symbol-3.1.3+~cs3.11.0/type/lib/resolve-exception.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/lib/resolve-exception.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/lib/resolve-exception.js 1985-10-26 08:15:00.000000000 +0000 @@ -9,5 +9,7 @@ if (inputOptions.isOptional) return null; } var ErrorConstructor = (inputOptions && inputOptions.Error) || TypeError; - throw new ErrorConstructor(resolveErrorMessage(defaultMessage, value, inputOptions)); + var error = new ErrorConstructor(resolveErrorMessage(defaultMessage, value, inputOptions)); + if (inputOptions && inputOptions.errorCode) error.code = inputOptions.errorCode; + throw error; }; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/map/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/map/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/map/ensure.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/map/ensure.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,12 @@ +"use strict"; + +var resolveException = require("../lib/resolve-exception") + , is = require("./is"); + +module.exports = function (value /*, options*/) { + if (is(value)) return value; + var options = arguments[1]; + var errorMessage = + options && options.name ? "Expected a map for %n, received %v" : "%v is not a map"; + return resolveException(value, errorMessage, options); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/map/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/map/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/map/is.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/map/is.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,28 @@ +"use strict"; + +var isPrototype = require("../prototype/is"); + +// In theory we could rely on Symbol.toStringTag directly, +// still early native implementation (e.g. in FF) predated symbols +var objectToString = Object.prototype.toString, objectTaggedString = objectToString.call(new Map()); + +module.exports = function (value) { + if (!value) return false; + + // Sanity check (reject objects which do not expose common Promise interface) + try { + if (typeof value.set !== "function") return false; + if (typeof value.get !== "function") return false; + if (typeof value.has !== "function") return false; + if (typeof value.clear !== "function") return false; + } catch (error) { + return false; + } + + // Ensure its native Promise object (has [[MapData]] slot) + // Note: it's not 100% precise as string tag may be overriden + // and other objects could be hacked to expose it + if (objectToString.call(value) !== objectTaggedString) return false; + + return !isPrototype(value); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/package.json node-es6-symbol-3.1.3+~cs3.11.0/type/package.json --- node-es6-symbol-3.1.3+~cs3.5.0/type/package.json 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/package.json 1985-10-26 08:15:00.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "type", - "version": "2.1.0", + "version": "2.5.0", "description": "Runtime validation and processing of JavaScript types", "author": "Mariusz Nowak (https://www.medikoo.com/)", "keywords": [ @@ -9,15 +9,15 @@ ], "repository": "medikoo/type", "devDependencies": { - "chai": "^4.2.0", - "eslint": "^7.7.0", - "eslint-config-medikoo": "^3.1.0", + "chai": "^4.3.3", + "eslint": "^7.21.0", + "eslint-config-medikoo": "^4.0.0", "git-list-updated": "^1.2.1", - "husky": "^4.2.5", - "lint-staged": "^10.2.11", + "husky": "^4.3.8", + "lint-staged": "^10.5.4", "mocha": "^6.2.3", "nyc": "^15.1.0", - "prettier-elastic": "^1.19.1" + "prettier-elastic": "^2.1.2" }, "husky": { "hooks": { diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/README.md node-es6-symbol-3.1.3+~cs3.11.0/type/README.md --- node-es6-symbol-3.1.3+~cs3.5.0/type/README.md 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/README.md 1985-10-26 08:15:00.000000000 +0000 @@ -67,7 +67,9 @@ - `errorMessage` - Custom error message. Following placeholders can be used: - `%v` - To be replaced with short string representation of invalid value - `%n` - To be replaced with meaninfgul name (to be passed with `name` option) of validated value. Not effective if `name` option is not present +- `errorCode` - Eventual error code to be exposed on `.code` error property - `name` - Meaningful name for validated value, to be used in error message, assuming it contains `%n` placeholder +- `Error` - Alternative error constructor to be used (defaults to `TypeError`) ### Index @@ -119,6 +121,12 @@ - **Iterable** - [`iterable/is`](docs/iterable.md#iterableis) - [`iterable/ensure`](docs/iterable.md#iterableensure) +- **Set** + - [`set/is`](docs/set.md#setis) + - [`set/ensure`](docs/set.md#setensure) +- **Map** + - [`map/is`](docs/map.md#mapis) + - [`map/ensure`](docs/map.md#mapensure) - **Date** - [`date/is`](docs/date.md#dateis) - [`date/ensure`](docs/date.md#dateensure) diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/set/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/set/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/set/ensure.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/set/ensure.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,12 @@ +"use strict"; + +var resolveException = require("../lib/resolve-exception") + , is = require("./is"); + +module.exports = function (value /*, options*/) { + if (is(value)) return value; + var options = arguments[1]; + var errorMessage = + options && options.name ? "Expected a set for %n, received %v" : "%v is not a set"; + return resolveException(value, errorMessage, options); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/set/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/set/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/set/is.js 1970-01-01 00:00:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/set/is.js 1985-10-26 08:15:00.000000000 +0000 @@ -0,0 +1,27 @@ +"use strict"; + +var isPrototype = require("../prototype/is"); + +// In theory we could rely on Symbol.toStringTag directly, +// still early native implementation (e.g. in FF) predated symbols +var objectToString = Object.prototype.toString, objectTaggedString = objectToString.call(new Set()); + +module.exports = function (value) { + if (!value) return false; + + // Sanity check (reject objects which do not expose common Promise interface) + try { + if (typeof value.add !== "function") return false; + if (typeof value.has !== "function") return false; + if (typeof value.clear !== "function") return false; + } catch (error) { + return false; + } + + // Ensure its native Promise object (has [[SetData]] slot) + // Note: it's not 100% precise as string tag may be overriden + // and other objects could be hacked to expose it + if (objectToString.call(value) !== objectTaggedString) return false; + + return !isPrototype(value); +}; diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/array/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/array/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/array/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/array/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureArray = require("../../array/ensure"); - -describe("array/ensure", function () { - it("Should return input value", function () { - var value = []; - assert.equal(ensureArray(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensureArray(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not an array"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureArray(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an array for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/array/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/array/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/array/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/array/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isArray = require("../../array/is"); - -describe("array/is", function () { - it("Should return true on array", function () { assert.equal(isArray([]), true); }); - - it("Should return false on array with no common API exposed", function () { - var value = []; - value.push = null; - assert.equal(isArray(value), false); - }); - it("Should return false on Array.prototype", function () { - assert.equal(isArray(Array.prototype), false); - }); - - it("Should return false on plain object", function () { assert.equal(isArray({}), false); }); - it("Should return false on function", function () { - assert.equal(isArray(function () { return true; }), false); - }); - - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isArray(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isArray("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isArray(""), false); }); - it("Should return false on number", function () { assert.equal(isArray(123), false); }); - it("Should return false on NaN", function () { assert.equal(isArray(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isArray(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isArray(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isArray(null), false); }); - it("Should return false on undefined", function () { assert.equal(isArray(void 0), false); }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-length/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-length/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-length/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-length/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToArrayLength = require("../../array-length/coerce"); - -describe("array-length/coerce", function () { - it("Should coerce float", function () { - assert.equal(coerceToArrayLength(123.123), 123); - assert.equal(coerceToArrayLength(123.823), 123); - }); - it("Should coerce string", function () { assert.equal(coerceToArrayLength("12.123"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToArrayLength(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToArrayLength(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToArrayLength({ valueOf: function () { return 23; } }), 23); - }); - it("Should reject infinite number", function () { - assert.equal(coerceToArrayLength(Infinity), null); - }); - it("Should reject number beyond Number.MAX_SAFE_INTEGER", function () { - assert.equal(coerceToArrayLength(9007199254740992), null); - }); - it("Should reject negative number", function () { - assert.equal(coerceToArrayLength(-9), null); - }); - - it("Should reject NaN", function () { assert.equal(coerceToArrayLength(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToArrayLength(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToArrayLength(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToArrayLength(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToArrayLength(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-length/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-length/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-length/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-length/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureArrayLength = require("../../array-length/ensure"); - -describe("array-length/ensure", function () { - it("Should return coerced value", function () { - assert.equal(ensureArrayLength("12.23"), 12); - }); - it("Should crash on no value", function () { - try { - ensureArrayLength(-20); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "-20 is not an array length"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureArrayLength(-20, { name: "foo" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an array length for foo, received -20"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-like/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-like/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-like/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-like/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureArrayLike = require("../../array-like/ensure"); - -describe("array-like/ensure", function () { - it("Should return input value", function () { - var value = []; - assert.equal(ensureArrayLike(value), value); - }); - it("Should allow strings with allowString option", function () { - var value = "foo"; - assert.equal(ensureArrayLike(value, { allowString: true }), value); - }); - it("Should crash on invalid value", function () { - try { - ensureArrayLike("foo"); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not an array like")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureArrayLike("foo", { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an array like for name, received foo"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-like/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-like/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/array-like/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/array-like/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isArrayLike = require("../../array-like/is"); - -describe("array-like/is", function () { - it("Should return true on array", function () { assert.equal(isArrayLike([]), true); }); - it("Should return true on array-like object", function () { - assert.equal(isArrayLike({ length: 1 }), true); - }); - it("Should by default return false on string", function () { - assert.equal(isArrayLike("foo"), false); - }); - it("Should accept strings if specified", function () { - assert.equal(isArrayLike("foo", { allowString: true }), true); - }); - - it("Should return false on objects with negative length", function () { - assert.equal(isArrayLike({ length: -1 }), false); - }); - - it("Should return false on plain object", function () { - assert.equal(isArrayLike({}), false); - }); - it("Should return false on function", function () { - assert.equal(isArrayLike(function () { return true; }), false); - }); - - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isArrayLike(Object.create(null)), false); - }); - } - it("Should return false on number", function () { assert.equal(isArrayLike(123), false); }); - it("Should return false on NaN", function () { assert.equal(isArrayLike(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isArrayLike(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isArrayLike(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isArrayLike(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isArrayLike(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/date/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/date/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/date/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/date/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureDate = require("../../date/ensure"); - -describe("date/ensure", function () { - it("Should return input value", function () { - var value = new Date(); - assert.equal(ensureDate(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensureDate(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not a date")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureDate(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a date for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/date/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/date/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/date/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/date/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isDate = require("../../date/is"); - -describe("date/is", function () { - it("Should return true on date", function () { assert.equal(isDate(new Date()), true); }); - it("Should return false on invalid date", function () { - assert.equal(isDate(new Date("foo")), false); - }); - - it("Should return false on native date with no common API exposed", function () { - var value = new Date(); - value.getFullYear = null; - assert.equal(isDate(value), false); - }); - it("Should return false on Date.prototype", function () { - assert.equal(isDate(Date.prototype), false); - }); - it("Should return false on time value", function () { assert.equal(isDate(12312313), false); }); - - it("Should return false on plain object", function () { assert.equal(isDate({}), false); }); - it("Should return false on function", function () { - assert.equal(isDate(function () { return true; }), false); - }); - - it("Should return false on array", function () { assert.equal(isDate([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isDate(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isDate("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isDate(""), false); }); - it("Should return false on number", function () { assert.equal(isDate(123), false); }); - it("Should return false on NaN", function () { assert.equal(isDate(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isDate(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isDate(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isDate(null), false); }); - it("Should return false on undefined", function () { assert.equal(isDate(void 0), false); }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensure = require("../ensure") - , ensureNumber = require("../number/ensure"); - -describe("ensure", function () { - it("Should support multiple validation datums", function () { - assert.deepEqual(ensure(["foo", 12.323, ensureNumber], ["bar", 10, ensureNumber]), [ - 12.323, 10 - ]); - }); - it("Should surface only error", function () { - try { - ensure(["foo", null, ensureNumber], ["bar", 10, ensureNumber]); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a number for foo, received null"); - } - }); - it("Should surface only error", function () { - try { - ensure(["foo", null, ensureNumber], ["bar", 10, ensureNumber]); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a number for foo, received null"); - } - }); - it("Should cumulate errors", function () { - try { - ensure(["foo", null, ensureNumber], ["bar", NaN, ensureNumber]); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal( - error.message, - "Approached following errors:" + - "\n - Expected a number for foo, received null" + - "\n - Expected a number for bar, received NaN" - ); - } - }); - it("Should support Error from global options", function () { - try { - ensure(["foo", null, ensureNumber], ["bar", NaN, ensureNumber], { Error: RangeError }); - } catch (error) { - assert.equal(error.name, "RangeError"); - assert.equal( - error.message, - "Approached following errors:" + - "\n - Expected a number for foo, received null" + - "\n - Expected a number for bar, received NaN" - ); - } - try { - ensure(["foo", null, ensureNumber], ["bar", 10, ensureNumber], { Error: RangeError }); - } catch (error) { - assert.equal(error.name, "RangeError"); - assert.equal(error.message, "Expected a number for foo, received null"); - } - }); - it("Should support individual validation options", function () { - try { - ensure(["foo", null, ensureNumber, { Error: RangeError }], ["bar", 10, ensureNumber]); - } catch (error) { - assert.equal(error.name, "RangeError"); - assert.equal(error.message, "Expected a number for foo, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/error/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/error/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/error/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/error/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureError = require("../../error/ensure"); - -describe("error/ensure", function () { - it("Should return input value", function () { - var value = new Error(); - assert.equal(ensureError(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensureError(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not an error")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureError(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an error for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/error/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/error/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/error/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/error/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isError = require("../../error/is"); - -describe("error/is", function () { - it("Should return true on error", function () { assert.equal(isError(new Error()), true); }); - - it("Should return false on native error with no common API exposed", function () { - var value = new Error(); - value.message = null; - assert.equal(isError(value), false); - }); - it("Should return false on Error.prototype", function () { - assert.equal(isError(Error.prototype), false); - }); - - if (typeof Object.create === "function") { - it("Should return true on custom built ES5 era error", function () { - var CustomEs5Error = function () { Error.call(this); }; - CustomEs5Error.prototype = Object.create(Error.prototype); - assert.equal(isError(new CustomEs5Error()), true); - }); - - it("Should return false on object with no prototype", function () { - assert.equal(isError(Object.create(null)), false); - }); - } - - it("Should return false on plain object", function () { assert.equal(isError({}), false); }); - it("Should return false on function", function () { - assert.equal(isError(function () { return true; }), false); - }); - - it("Should return false on array", function () { assert.equal(isError([]), false); }); - - it("Should return false on string", function () { assert.equal(isError("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isError(""), false); }); - it("Should return false on number", function () { assert.equal(isError(123), false); }); - it("Should return false on NaN", function () { assert.equal(isError(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isError(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isError(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isError(null), false); }); - it("Should return false on undefined", function () { assert.equal(isError(void 0), false); }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/finite/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/finite/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/finite/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/finite/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToFinite = require("../../finite/coerce"); - -describe("finite/coerce", function () { - it("Should return input number", function () { - assert.equal(coerceToFinite(123.123), 123.123); - }); - it("Should coerce string", function () { assert.equal(coerceToFinite("12"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToFinite(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToFinite(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToFinite({ valueOf: function () { return 23; } }), 23); - }); - - it("Should reject infinite number", function () { - assert.equal(coerceToFinite(Infinity), null); - }); - it("Should reject NaN", function () { assert.equal(coerceToFinite(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToFinite(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToFinite(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToFinite(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToFinite(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/finite/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/finite/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/finite/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/finite/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureFinite = require("../../finite/ensure"); - -describe("finite/ensure", function () { - it("Should return coerced value", function () { assert.equal(ensureFinite("12.23"), 12.23); }); - it("Should crash on no value", function () { - try { - ensureFinite(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not a finite number"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureFinite(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a finite number for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/function/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/function/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/function/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/function/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureFunction = require("../../function/ensure"); - -describe("function/ensure", function () { - it("Should return input value", function () { - var value = function () { return true; }; - assert.equal(ensureFunction(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensureFunction(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not a function")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureFunction(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a function for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/function/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/function/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/function/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/function/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isFunction = require("../../function/is") - , arrowFunctionIfSupported = require("../_lib/arrow-function-if-supported") - , classIfSupported = require("../_lib/class-if-supported"); - -describe("function/is", function () { - it("Should return true on function", function () { - assert.equal(isFunction(function () { return true; }), true); - }); - if (arrowFunctionIfSupported) { - it("Should return true on arrow function", function () { - assert.equal(isFunction(arrowFunctionIfSupported), true); - }); - } - if (classIfSupported) { - it("Should return true on class", function () { - assert.equal(isFunction(classIfSupported), true); - }); - } - it("Should return false on reg-exp", function () { assert.equal(isFunction(/foo/), false); }); - - it("Should return false on plain object", function () { assert.equal(isFunction({}), false); }); - it("Should return false on array", function () { assert.equal(isFunction([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isFunction(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isFunction("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isFunction(""), false); }); - it("Should return false on number", function () { assert.equal(isFunction(123), false); }); - it("Should return false on NaN", function () { assert.equal(isFunction(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isFunction(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isFunction(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isFunction(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isFunction(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/integer/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/integer/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/integer/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/integer/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToInteger = require("../../integer/coerce"); - -describe("integer/coerce", function () { - it("Should coerce float to integer", function () { - assert.equal(coerceToInteger(123.123), 123); - assert.equal(coerceToInteger(123.823), 123); - assert.equal(coerceToInteger(-123.123), -123); - assert.equal(coerceToInteger(-123.823), -123); - }); - it("Should coerce string", function () { assert.equal(coerceToInteger("12.123"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToInteger(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToInteger(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToInteger({ valueOf: function () { return 23; } }), 23); - }); - it("Should coerce number beyond Number.MAX_SAFE_INTEGER", function () { - assert.equal(coerceToInteger(9007199254740992), 9007199254740992); - }); - it("Should coerce number beyond Number.MIN_SAFE_INTEGER", function () { - assert.equal(coerceToInteger(-9007199254740992), -9007199254740992); - }); - - it("Should reject infinite number", function () { - assert.equal(coerceToInteger(Infinity), null); - }); - it("Should reject NaN", function () { assert.equal(coerceToInteger(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToInteger(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToInteger(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToInteger(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToInteger(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/integer/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/integer/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/integer/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/integer/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureInteger = require("../../integer/ensure"); - -describe("integer/ensure", function () { - it("Should return coerced value", function () { assert.equal(ensureInteger("12.23"), 12); }); - it("Should crash on no value", function () { - try { - ensureInteger(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not an integer"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureInteger(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an integer for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/iterable/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/iterable/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/iterable/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/iterable/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureString = require("../../string/ensure") - , isArray = require("../../array/is") - , ensureIterable = require("../../iterable/ensure"); - -describe("iterable/ensure", function () { - it("Should return input value", function () { - var value = []; - assert.equal(ensureIterable(value), value); - }); - it("Should allow strings with allowString option", function () { - var value = "foo"; - assert.equal(ensureIterable(value, { allowString: true }), value); - }); - it("Should crash on invalid value", function () { - try { - ensureIterable("foo"); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not expected iterable")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureIterable("foo", { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an iterable for name, received foo"); - } - }); - describe("Should support 'ensureItem' option", function () { - it("Should resolve coerced array", function () { - var coercedValue = ensureIterable(new Set(["foo", 12]), { ensureItem: ensureString }); - assert(isArray(coercedValue)); - assert.deepEqual(coercedValue, ["foo", "12"]); - }); - it("Should crash if some item is invalid", function () { - try { - ensureIterable(["foo", {}], { ensureItem: ensureString }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not expected iterable")); - } - }); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/iterable/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/iterable/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/iterable/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/iterable/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isIterable = require("../../iterable/is"); - -describe("iterable/is", function () { - it("Should return true on array", function () { assert.equal(isIterable([]), true); }); - it("Should return true on arguments", function () { - assert.equal(isIterable((function () { return arguments; })()), true); - }); - it("Should by default return false on string", function () { - assert.equal(isIterable("foo"), false); - }); - it("Should accept strings if specified", function () { - assert.equal(isIterable("foo", { allowString: true }), true); - }); - - it("Should support denyEmpty option", function () { - assert.equal(isIterable([], { denyEmpty: true }), false); - assert.equal(isIterable([null], { denyEmpty: true }), true); - assert.equal(isIterable("", { allowString: true, denyEmpty: true }), false); - assert.equal(isIterable("foo", { allowString: true, denyEmpty: true }), true); - }); - - if (typeof Set === "function") { - it("Should return true on set", function () { assert.equal(isIterable(new Set()), true); }); - } - if (typeof Map === "function") { - it("Should return true on set", function () { assert.equal(isIterable(new Map()), true); }); - } - - it("Should return false on plain object", function () { assert.equal(isIterable({}), false); }); - it("Should return false on function", function () { - assert.equal(isIterable(function () { return true; }), false); - }); - - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isIterable(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isIterable("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isIterable(""), false); }); - it("Should return false on number", function () { assert.equal(isIterable(123), false); }); - it("Should return false on NaN", function () { assert.equal(isIterable(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isIterable(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isIterable(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isIterable(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isIterable(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/is-to-string-tag-supported.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/is-to-string-tag-supported.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/is-to-string-tag-supported.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/is-to-string-tag-supported.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isToStringTagSupported = require("../../lib/is-to-string-tag-supported"); - -describe("lib/is-to-string-tag-supported", function () { - it("Should return boolean", function () { - assert(typeof isToStringTagSupported === "boolean"); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/resolve-error-message.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/resolve-error-message.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/resolve-error-message.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/resolve-error-message.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , resolveErrorMessage = require("../../lib/resolve-error-message"); - -describe("lib/resolve-error-message", function () { - it("Should insert value", function () { - assert.equal(resolveErrorMessage("%v is invalid", 12), "12 is invalid"); - assert.equal(resolveErrorMessage("Value is invalid", 12), "Value is invalid"); - }); - it("Should support custom error message via inputOptions.errorMessage", function () { - assert.equal( - resolveErrorMessage("%v is invalid", null, { errorMessage: "%v is not supported age" }), - "null is not supported age" - ); - }); - it("Should support %n (name) token", function () { - assert.equal(resolveErrorMessage("%v is invalid", 12, { name: "foo" }), "12 is invalid"); - assert.equal(resolveErrorMessage("%n is invalid", 12, { name: "foo" }), "foo is invalid"); - assert.equal( - resolveErrorMessage("%v for %n is invalid", 12, { name: "foo" }), - "12 for foo is invalid" - ); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/resolve-exception.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/resolve-exception.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/resolve-exception.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/resolve-exception.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , handleException = require("../../lib/resolve-exception"); - -describe("lib/handle-exception", function () { - it("Should throw TypeError", function () { - try { - handleException(12, "Invalid value"); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Invalid value"); - } - }); - it("Should resolve value in default message", function () { - try { - handleException(12, "%v is invalid", {}); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.message, "12 is invalid"); - } - }); - it("Should support optional values via inputOptions.isOptional", function () { - assert.equal(handleException(null, "%v is invalid", { isOptional: true }, null)); - }); - it("Should support optional values via inputOptions.default", function () { - // prettier-ignore - assert.equal(handleException(null, "%v is invalid", { "default": "bar" }), "bar"); - }); - it("Should support custom Error constructor", function () { - try { - handleException(12, "Invalid value", { Error: RangeError }); - throw new Error("Unexpected"); - } catch (error) { - assert(error instanceof RangeError); - assert.equal(error.message, "Invalid value"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/safe-to-string.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/safe-to-string.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/safe-to-string.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/safe-to-string.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , safeToString = require("../../lib/safe-to-string"); - -describe("lib/safe-to-string", function () { - it("Should return input string", function () { assert.equal(safeToString("foo"), "foo"); }); - it("Should coerce numbers", function () { assert.equal(safeToString(12), "12"); }); - it("Should coerce booleans", function () { assert.equal(safeToString(true), "true"); }); - it("Should coerce string objects", function () { - assert.equal(safeToString(new String("bar")), "bar"); - }); - it("Should coerce objects", function () { - assert.equal( - safeToString({ toString: function () { return "Some object"; } }), "Some object" - ); - }); - it("Should coerce null", function () { assert.equal(safeToString(null), "null"); }); - it("Should coerce undefined", function () { - assert.equal(safeToString(undefined), "undefined"); - }); - - if (typeof Symbol === "function") { - it("Should coerce symbols", function () { - // eslint-disable-next-line no-undef - assert.equal(safeToString(Symbol()), "Symbol()"); - }); - } - it("Should return null for non coercible values", function () { - assert.equal(safeToString({ toString: null }), null); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/to-short-string.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/to-short-string.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/lib/to-short-string.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/lib/to-short-string.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , toShortString = require("../../lib/to-short-string"); - -describe("lib/to-short-string", function () { - it("Should return input string", function () { assert.equal(toShortString("foo"), "foo"); }); - it("Should coerce numbers", function () { assert.equal(toShortString(12), "12"); }); - it("Should coerce booleans", function () { assert.equal(toShortString(true), "true"); }); - it("Should coerce string objects", function () { - assert.equal(toShortString(new String("bar")), "bar"); - }); - it("Should coerce objects", function () { - assert.equal( - toShortString({ toString: function () { return "Some object"; } }), "Some object" - ); - }); - it("Should coerce null", function () { assert.equal(toShortString(null), "null"); }); - it("Should coerce undefined", function () { - assert.equal(toShortString(undefined), "undefined"); - }); - - if (typeof Symbol === "function") { - it("Should coerce symbols", function () { - // eslint-disable-next-line no-undef - assert.equal(toShortString(Symbol()), "Symbol()"); - }); - } - it("Should return replacement non coercible values", function () { - assert.equal(toShortString({ toString: null }), ""); - }); - - it("Should replace new line characters", function () { - assert.equal(toShortString("foo\n\r\u2028\u2029bar"), "foo\\n\\r\\u2028\\u2029bar"); - }); - it("Should truncate long string", function () { - var str = Math.random().toString(36); - while (str.length < 200) str += str; - assert.equal(toShortString(str).length, 100); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/_lib/arrow-function-if-supported.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/_lib/arrow-function-if-supported.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/_lib/arrow-function-if-supported.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/_lib/arrow-function-if-supported.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -"use strict"; - -try { module.exports = eval("(() => {})"); } -catch (error) {} diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/_lib/class-if-supported.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/_lib/class-if-supported.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/_lib/class-if-supported.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/_lib/class-if-supported.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -"use strict"; - -try { module.exports = eval("(class {})"); } -catch (error) {} diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/natural-number/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/natural-number/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/natural-number/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/natural-number/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToNaturalNumber = require("../../natural-number/coerce"); - -describe("natural-number/coerce", function () { - it("Should coerce float to integer", function () { - assert.equal(coerceToNaturalNumber(123.123), 123); - assert.equal(coerceToNaturalNumber(123.823), 123); - }); - it("Should coerce string", function () { assert.equal(coerceToNaturalNumber("12.123"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToNaturalNumber(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToNaturalNumber(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToNaturalNumber({ valueOf: function () { return 23; } }), 23); - }); - it("Should coerce number beyond Number.MAX_SAFE_INTEGER", function () { - assert.equal(coerceToNaturalNumber(9007199254740992), 9007199254740992); - }); - - it("Should reject negative number", function () { - assert.equal(coerceToNaturalNumber(-1), null); - }); - it("Should reject infinite number", function () { - assert.equal(coerceToNaturalNumber(Infinity), null); - }); - it("Should reject NaN", function () { assert.equal(coerceToNaturalNumber(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToNaturalNumber(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToNaturalNumber(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToNaturalNumber(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToNaturalNumber(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/natural-number/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/natural-number/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/natural-number/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/natural-number/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureNaturalNumber = require("../../natural-number/ensure"); - -describe("natural-number/ensure", function () { - it("Should return coerced value", function () { - assert.equal(ensureNaturalNumber("12.23"), 12); - }); - it("Should crash on no value", function () { - try { - ensureNaturalNumber(-20); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "-20 is not a natural number"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureNaturalNumber(-20, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a natural number for name, received -20"); - } - }); - it("Should support min validation", function () { - try { - ensureNaturalNumber(2, { min: 3 }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "2 is not greater or equal 3"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/number/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/number/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/number/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/number/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToNumber = require("../../number/coerce"); - -describe("number/coerce", function () { - it("Should return input number", function () { - assert.equal(coerceToNumber(123.123), 123.123); - }); - it("Should return input infinite number", function () { - assert.equal(coerceToNumber(Infinity), Infinity); - }); - it("Should coerce string", function () { assert.equal(coerceToNumber("12"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToNumber(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToNumber(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToNumber({ valueOf: function () { return 23; } }), 23); - }); - - it("Should reject NaN", function () { assert.equal(coerceToNumber(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToNumber(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToNumber(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToNumber(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToNumber(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/number/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/number/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/number/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/number/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureNumber = require("../../number/ensure"); - -describe("number/ensure", function () { - it("Should return coerced value", function () { assert.equal(ensureNumber("12.23"), 12.23); }); - it("Should crash on no value", function () { - try { - ensureNumber(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not a number"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureNumber(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a number for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/object/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/object/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/object/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/object/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureObject = require("../../object/ensure"); - -describe("object/ensure", function () { - it("Should return input value", function () { - var value = {}; - assert.equal(ensureObject(value), value); - }); - it("Should crash on no value", function () { - try { - ensureObject(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not an object"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureObject(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected an object for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/object/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/object/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/object/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/object/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isObject = require("../../object/is"); - -describe("object/is", function () { - it("Should return true on object", function () { assert.equal(isObject({}), true); }); - it("Should return true on function", function () { - assert.equal(isObject(function () { return true; }), true); - }); - it("Should return true on array", function () { assert.equal(isObject([]), true); }); - if (typeof Object.create === "function") { - it("Should return true on object with no prototype", function () { - assert.equal(isObject(Object.create(null)), true); - }); - } - it("Should return false on string", function () { assert.equal(isObject("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isObject(""), false); }); - it("Should return false on number", function () { assert.equal(isObject(123), false); }); - it("Should return false on NaN", function () { assert.equal(isObject(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isObject(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isObject(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isObject(null), false); }); - it("Should return false on undefined", function () { assert.equal(isObject(void 0), false); }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-function/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-function/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-function/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-function/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensurePlainFunction = require("../../plain-function/ensure"); - -describe("plain-function/ensure", function () { - it("Should return input value", function () { - var value = function () { return true; }; - assert.equal(ensurePlainFunction(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensurePlainFunction(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not a plain function")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensurePlainFunction(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a plain function for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-function/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-function/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-function/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-function/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isPlainFunction = require("../../plain-function/is") - , arrowFunctionIfSupported = require("../_lib/arrow-function-if-supported") - , classIfSupported = require("../_lib/class-if-supported"); - -describe("plain-function/is", function () { - it("Should return true on function", function () { - assert.equal(isPlainFunction(function () { return true; }), true); - }); - if (arrowFunctionIfSupported) { - it("Should return true on arrow function", function () { - assert.equal(isPlainFunction(arrowFunctionIfSupported), true); - }); - } - if (classIfSupported) { - it("Should return false on class", function () { - assert.equal(isPlainFunction(classIfSupported), false); - }); - } - it("Should return false on reg-exp", function () { - assert.equal(isPlainFunction(/foo/), false); - }); - - it("Should return false on plain object", function () { - assert.equal(isPlainFunction({}), false); - }); - it("Should return false on array", function () { assert.equal(isPlainFunction([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isPlainFunction(Object.create(null)), false); - }); - } - it("Should return false on string", function () { - assert.equal(isPlainFunction("foo"), false); - }); - it("Should return false on empty string", function () { - assert.equal(isPlainFunction(""), false); - }); - it("Should return false on number", function () { assert.equal(isPlainFunction(123), false); }); - it("Should return false on NaN", function () { assert.equal(isPlainFunction(NaN), false); }); - it("Should return false on boolean", function () { - assert.equal(isPlainFunction(true), false); - }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isPlainFunction(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isPlainFunction(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isPlainFunction(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-object/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-object/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-object/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-object/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureString = require("../../string/ensure") - , ensurePlainObject = require("../../plain-object/ensure"); - -describe("plain-object/ensure", function () { - it("Should return input value", function () { - var value = {}; - assert.equal(ensurePlainObject(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensurePlainObject(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not a plain object"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensurePlainObject(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a plain object for name, received null"); - } - }); - it("Should support allowedKeys option", function () { - var value = { foo: "bar", marko: "elo" }; - assert.equal(ensurePlainObject(value, { allowedKeys: ["foo", "marko"] }), value); - try { - ensurePlainObject(value, { allowedKeys: ["marko"] }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message.indexOf("is not a plain object") !== -1, true); - } - }); - - it("Should support ensurePropertyValue option", function () { - assert.deepEqual( - ensurePlainObject({ foo: "bar", marko: 12 }, { ensurePropertyValue: ensureString }), - { foo: "bar", marko: "12" } - ); - try { - ensurePlainObject({ foo: "bar", marko: {} }, { ensurePropertyValue: ensureString }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message.indexOf("is not a plain object") !== -1, true); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-object/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-object/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/plain-object/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/plain-object/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isPlainObject = require("../../plain-object/is"); - -describe("plain-object/is", function () { - it("Should return true on plain object", function () { - assert.equal(isPlainObject({}), true); - }); - if (typeof Object.create === "function") { - it("Should return true on object with no prototype", function () { - assert.equal(isPlainObject(Object.create(null)), true); - }); - it( - "Should return false on object that inherits from object with no prototype", - function () { assert.equal(isPlainObject(Object.create(Object.create(null))), false); } - ); - } - it("Should return false on Object.prototype", function () { - assert.equal(isPlainObject(Object.prototype), false); - }); - it("Should return false on prototype that derives from Object.prototype", function () { - assert.equal(isPlainObject(RegExp.prototype), false); - }); - - it("Should return false on function", function () { - assert.equal(isPlainObject(function () { return true; }), false); - }); - - it("Should return false on string", function () { assert.equal(isPlainObject("foo"), false); }); - it("Should return false on empty string", function () { - assert.equal(isPlainObject(""), false); - }); - it("Should return false on number", function () { assert.equal(isPlainObject(123), false); }); - it("Should return false on NaN", function () { assert.equal(isPlainObject(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isPlainObject(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isPlainObject(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isPlainObject(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isPlainObject(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/promise/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/promise/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/promise/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/promise/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensurePromise = require("../../promise/ensure"); - -describe("promise/ensure", function () { - it("Should return input value", function () { - var value = Promise.resolve(); - assert.equal(ensurePromise(value), value); - }); - it("Should crash on no value", function () { - try { - ensurePromise({}); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "[object Object] is not a promise"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensurePromise(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a promise for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/promise/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/promise/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/promise/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/promise/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isPromise = require("../../promise/is"); - -describe("promise/is", function () { - if (typeof Promise === "function") { - it("Should return true on promise", function () { - assert.equal(isPromise(Promise.resolve()), true); - }); - } - it("Should return false on non-promise thenable", function () { - assert.equal(isPromise({ then: function () { return true; } }), false); - }); - - it("Should return false on plain object", function () { assert.equal(isPromise({}), false); }); - it("Should return false on function", function () { - assert.equal(isPromise(function () { return true; }), false); - }); - it("Should return false on array", function () { assert.equal(isPromise([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isPromise(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isPromise("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isPromise(""), false); }); - it("Should return false on number", function () { assert.equal(isPromise(123), false); }); - it("Should return false on NaN", function () { assert.equal(isPromise(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isPromise(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isPromise(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isPromise(null), false); }); - it("Should return false on undefined", function () { assert.equal(isPromise(void 0), false); }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/prototype/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/prototype/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/prototype/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/prototype/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isPrototype = require("../../prototype/is"); - -describe("prototype/is", function () { - it("Should return true on prototype", function () { - assert.equal(isPrototype(Object.prototype), true); - }); - it("Should return false on plain object", function () { - assert.equal(isPrototype({}), false); - }); - it("Should return false on function", function () { - assert.equal(isPrototype(function () { return true; }), false); - }); - it("Should return false on array", function () { assert.equal(isPrototype([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isPrototype(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isPrototype("foo"), false); }); - it("Should return false on empty string", function () { - assert.equal(isPrototype(""), false); - }); - it("Should return false on number", function () { assert.equal(isPrototype(123), false); }); - it("Should return false on NaN", function () { assert.equal(isPrototype(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isPrototype(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isPrototype(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isPrototype(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isPrototype(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/reg-exp/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/reg-exp/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/reg-exp/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/reg-exp/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureRegExp = require("../../reg-exp/ensure"); - -describe("reg-exp/ensure", function () { - it("Should return input value", function () { - var value = /foo/; - assert.equal(ensureRegExp(value), value); - }); - it("Should crash on invalid value", function () { - try { - ensureRegExp(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert(error.message.includes("is not a regular expression")); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureRegExp(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a regular expression for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/reg-exp/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/reg-exp/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/reg-exp/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/reg-exp/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isRegExp = require("../../reg-exp/is"); - -describe("reg-exp/is", function () { - it("Should return true on regular expression", function () { - assert.equal(isRegExp(/foo/), true); - }); - - it("Should return false on native regular expression with no common API exposed", function () { - var re = /foo/; - re.test = null; - assert.equal(isRegExp(re), false); - }); - it("Should return false on RegExp.prototype", function () { - assert.equal(isRegExp(RegExp.prototype), false); - }); - it("Should return false on regexp like string", function () { - assert.equal(isRegExp("/foo/"), false); - }); - - it("Should return false on plain object", function () { assert.equal(isRegExp({}), false); }); - it("Should return false on function", function () { - assert.equal(isRegExp(function () { return true; }), false); - }); - - it("Should return false on array", function () { assert.equal(isRegExp([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isRegExp(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isRegExp("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isRegExp(""), false); }); - it("Should return false on number", function () { assert.equal(isRegExp(123), false); }); - it("Should return false on NaN", function () { assert.equal(isRegExp(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isRegExp(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isRegExp(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isRegExp(null), false); }); - it("Should return false on undefined", function () { assert.equal(isRegExp(void 0), false); }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/safe-integer/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/safe-integer/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/safe-integer/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/safe-integer/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToSafeInteger = require("../../safe-integer/coerce"); - -describe("safe-integer/coerce", function () { - it("Should coerce float to integer", function () { - assert.equal(coerceToSafeInteger(123.123), 123); - assert.equal(coerceToSafeInteger(123.823), 123); - assert.equal(coerceToSafeInteger(-123.123), -123); - assert.equal(coerceToSafeInteger(-123.823), -123); - }); - it("Should coerce string", function () { assert.equal(coerceToSafeInteger("12.123"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToSafeInteger(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToSafeInteger(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToSafeInteger({ valueOf: function () { return 23; } }), 23); - }); - it("Should reject infinite number", function () { - assert.equal(coerceToSafeInteger(Infinity), null); - }); - it("Should reject number beyond Number.MAX_SAFE_INTEGER", function () { - assert.equal(coerceToSafeInteger(9007199254740992), null); - }); - it("Should reject number beyond Number.MIN_SAFE_INTEGER", function () { - assert.equal(coerceToSafeInteger(-9007199254740992), null); - }); - - it("Should reject NaN", function () { assert.equal(coerceToSafeInteger(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToSafeInteger(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToSafeInteger(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToSafeInteger(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToSafeInteger(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/safe-integer/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/safe-integer/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/safe-integer/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/safe-integer/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureSafeInteger = require("../../safe-integer/ensure"); - -describe("safe-integer/ensure", function () { - it("Should return coerced value", function () { - assert.equal(ensureSafeInteger("12.23"), 12); - }); - it("Should crash on no value", function () { - try { - ensureSafeInteger(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not a safe integer"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureSafeInteger(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a safe integer for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/string/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/string/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/string/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/string/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToString = require("../../string/coerce"); - -describe("string/coerce", function () { - it("Should return input string", function () { assert.equal(coerceToString("foo"), "foo"); }); - it("Should coerce numbers", function () { assert.equal(coerceToString(12), "12"); }); - it("Should coerce booleans", function () { assert.equal(coerceToString(true), "true"); }); - it("Should coerce string objects", function () { - assert.equal(coerceToString(new String("bar")), "bar"); - }); - it("Should coerce objects", function () { - assert.equal( - coerceToString({ toString: function () { return "Some object"; } }), "Some object" - ); - }); - if (typeof Object.create === "function") { - it("Should not coerce objects with no toString", function () { - assert.equal(coerceToString(Object.create(null)), null); - }); - } - it("Should not coerce objects with no custom toString", function () { - assert.equal(coerceToString({}), null); - }); - it("Should not coerce null", function () { assert.equal(coerceToString(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToString(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToString(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/string/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/string/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/string/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/string/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureString = require("../../string/ensure"); - -describe("string/ensure", function () { - it("Should return coerced value", function () { assert.equal(ensureString(12), "12"); }); - it("Should crash on no value", function () { - try { - ensureString(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "null is not a string"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureString(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a string for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/thenable/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/thenable/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/thenable/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/thenable/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureThenable = require("../../thenable/ensure"); - -describe("thenable/ensure", function () { - it("Should return input value", function () { - var value = { then: function () { return true; } }; - assert.equal(ensureThenable(value), value); - }); - it("Should crash on no value", function () { - try { - ensureThenable({}); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "[object Object] is not a thenable"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureThenable({}, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a thenable for name, received [object Object]"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/thenable/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/thenable/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/thenable/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/thenable/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isThenable = require("../../thenable/is"); - -describe("thenable/is", function () { - it("Should return true on object with `then` method", function () { - assert.equal(isThenable({ then: function () { return true; } }), true); - }); - if (typeof Promise === "function") { - it("Should return true on promise", function () { - assert.equal(isThenable(Promise.resolve()), true); - }); - } - it("Should return false on object with `then` non callable property", function () { - assert.equal(isThenable({ then: {} }), false); - }); - - it("Should return false on plain object", function () { assert.equal(isThenable({}), false); }); - it("Should return false on function", function () { - assert.equal(isThenable(function () { return true; }), false); - }); - it("Should return false on array", function () { assert.equal(isThenable([]), false); }); - if (typeof Object.create === "function") { - it("Should return false on object with no prototype", function () { - assert.equal(isThenable(Object.create(null)), false); - }); - } - it("Should return false on string", function () { assert.equal(isThenable("foo"), false); }); - it("Should return false on empty string", function () { assert.equal(isThenable(""), false); }); - it("Should return false on number", function () { assert.equal(isThenable(123), false); }); - it("Should return false on NaN", function () { assert.equal(isThenable(NaN), false); }); - it("Should return false on boolean", function () { assert.equal(isThenable(true), false); }); - if (typeof Symbol === "function") { - it("Should return false on symbol", function () { - assert.equal(isThenable(Symbol("foo")), false); - }); - } - - it("Should return false on null", function () { assert.equal(isThenable(null), false); }); - it("Should return false on undefined", function () { - assert.equal(isThenable(void 0), false); - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/time-value/coerce.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/time-value/coerce.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/time-value/coerce.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/time-value/coerce.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , coerceToTimeValue = require("../../time-value/coerce"); - -describe("time-value/coerce", function () { - it("Should coerce float to time value", function () { - assert.equal(coerceToTimeValue(123.123), 123); - assert.equal(coerceToTimeValue(123.823), 123); - assert.equal(coerceToTimeValue(-123.123), -123); - assert.equal(coerceToTimeValue(-123.823), -123); - }); - it("Should coerce string", function () { assert.equal(coerceToTimeValue("12.123"), 12); }); - it("Should coerce booleans", function () { assert.equal(coerceToTimeValue(true), 1); }); - it("Should coerce number objects", function () { - assert.equal(coerceToTimeValue(new Number(343)), 343); - }); - it("Should coerce objects", function () { - assert.equal(coerceToTimeValue({ valueOf: function () { return 23; } }), 23); - }); - it("Should reject infinite number", function () { - assert.equal(coerceToTimeValue(Infinity), null); - }); - it("Should reject number beyond 100,000,000 days from unix epox", function () { - assert.equal(coerceToTimeValue(8.64e15 + 1), null); - assert.equal(coerceToTimeValue(-8.64e15 - 1), null); - }); - - it("Should reject NaN", function () { assert.equal(coerceToTimeValue(NaN), null); }); - - if (typeof Object.create === "function") { - it("Should not coerce objects with no number representation", function () { - assert.equal(coerceToTimeValue(Object.create(null)), null); - }); - } - - it("Should not coerce null", function () { assert.equal(coerceToTimeValue(null), null); }); - it("Should not coerce undefined", function () { - assert.equal(coerceToTimeValue(undefined), null); - }); - - if (typeof Symbol === "function") { - it("Should not coerce symbols", function () { - assert.equal(coerceToTimeValue(Symbol("foo")), null); - }); - } -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/time-value/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/time-value/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/time-value/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/time-value/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureTimeValue = require("../../time-value/ensure"); - -describe("time-value/ensure", function () { - it("Should return coerced value", function () { assert.equal(ensureTimeValue("12.23"), 12); }); - it("Should crash on no value", function () { - try { - ensureTimeValue("foo"); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "foo is not a time value"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureTimeValue("foo", { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a time value for name, received foo"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/value/ensure.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/value/ensure.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/value/ensure.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/value/ensure.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , ensureValue = require("../../value/ensure"); - -describe("value/ensure", function () { - it("Should return input value", function () { - var value = {}; - assert.equal(ensureValue(value), value); - }); - it("Should crash on no value", function () { - try { - ensureValue(null); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Cannot use null"); - } - }); - it("Should provide alternative error message when name option is passed", function () { - try { - ensureValue(null, { name: "name" }); - throw new Error("Unexpected"); - } catch (error) { - assert.equal(error.name, "TypeError"); - assert.equal(error.message, "Expected a value for name, received null"); - } - }); -}); diff -Nru node-es6-symbol-3.1.3+~cs3.5.0/type/test/value/is.js node-es6-symbol-3.1.3+~cs3.11.0/type/test/value/is.js --- node-es6-symbol-3.1.3+~cs3.5.0/type/test/value/is.js 1985-10-26 08:15:00.000000000 +0000 +++ node-es6-symbol-3.1.3+~cs3.11.0/type/test/value/is.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -"use strict"; - -var assert = require("chai").assert - , isValue = require("../../value/is"); - -describe("value/is", function () { - it("Should return true on object", function () { assert.equal(isValue({}), true); }); - it("Should return true on function", function () { - assert.equal(isValue(function () { return true; }), true); - }); - it("Should return true on array", function () { assert.equal(isValue([]), true); }); - if (typeof Object.create === "function") { - it("Should return true on object with no prototype", function () { - assert.equal(isValue(Object.create(null)), true); - }); - } - it("Should return true on string", function () { assert.equal(isValue("foo"), true); }); - it("Should return true on empty string", function () { assert.equal(isValue(""), true); }); - it("Should return true on number", function () { assert.equal(isValue(123), true); }); - it("Should return true on NaN", function () { assert.equal(isValue(NaN), true); }); - it("Should return true on boolean", function () { assert.equal(isValue(false), true); }); - if (typeof Symbol === "function") { - // eslint-disable-next-line no-undef - it("Should return true on symbol", function () { assert.equal(isValue(Symbol()), true); }); - } - - it("Should return false on null", function () { assert.equal(isValue(null), false); }); - it("Should return false on undefined", function () { assert.equal(isValue(void 0), false); }); -});