@blackglory/structures 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,61 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
+ /* global Reflect, Promise */
16
+
17
+ var extendStatics = function(d, b) {
18
+ extendStatics = Object.setPrototypeOf ||
19
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
+ return extendStatics(d, b);
22
+ };
23
+
24
+ function __extends(d, b) {
25
+ if (typeof b !== "function" && b !== null)
26
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27
+ extendStatics(d, b);
28
+ function __() { this.constructor = d; }
29
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
+ }
31
+
32
+ function __values(o) {
33
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
34
+ if (m) return m.call(o);
35
+ if (o && typeof o.length === "number") return {
36
+ next: function () {
37
+ if (o && i >= o.length) o = void 0;
38
+ return { value: o && o[i++], done: !o };
39
+ }
40
+ };
41
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
42
+ }
43
+
44
+ function __read(o, n) {
45
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
46
+ if (!m) return o;
47
+ var i = m.call(o), r, ar = [], e;
48
+ try {
49
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
50
+ }
51
+ catch (error) { e = { error: error }; }
52
+ finally {
53
+ try {
54
+ if (r && !r.done && (m = i["return"])) m.call(i);
55
+ }
56
+ finally { if (e) throw e.error; }
57
+ }
58
+ return ar;
59
+ }
60
+
61
+ function __spreadArray(to, from, pack) {
62
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
63
+ if (ar || !(i in from)) {
64
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
65
+ ar[i] = from[i];
66
+ }
67
+ }
68
+ return to.concat(ar || Array.prototype.slice.call(from));
69
+ }
15
70
 
16
71
  function __classPrivateFieldGet(receiver, state, kind, f) {
17
72
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
@@ -508,10 +563,10 @@ function isntObject$1(val) {
508
563
  return !isObject$1(val);
509
564
  }
510
565
  object$1.isntObject = isntObject$1;
511
- function isRecord$1(val) {
566
+ function isRecord(val) {
512
567
  return isObject$1(val);
513
568
  }
514
- object$1.isRecord = isRecord$1;
569
+ object$1.isRecord = isRecord;
515
570
  function isEmptyObject$1(val) {
516
571
  return Object.keys(val).length === 0;
517
572
  }
@@ -2970,72 +3025,6 @@ class BadEventError extends es2018$6.CustomError {
2970
3025
  }
2971
3026
  }
2972
3027
 
2973
- /*! *****************************************************************************
2974
- Copyright (c) Microsoft Corporation.
2975
-
2976
- Permission to use, copy, modify, and/or distribute this software for any
2977
- purpose with or without fee is hereby granted.
2978
-
2979
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2980
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2981
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2982
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2983
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2984
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2985
- PERFORMANCE OF THIS SOFTWARE.
2986
- ***************************************************************************** */
2987
- /* global Reflect, Promise */
2988
-
2989
- var extendStatics = function(d, b) {
2990
- extendStatics = Object.setPrototypeOf ||
2991
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2992
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
2993
- return extendStatics(d, b);
2994
- };
2995
-
2996
- function __extends(d, b) {
2997
- if (typeof b !== "function" && b !== null)
2998
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
2999
- extendStatics(d, b);
3000
- function __() { this.constructor = d; }
3001
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3002
- }
3003
-
3004
- function __values(o) {
3005
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3006
- if (m) return m.call(o);
3007
- if (o && typeof o.length === "number") return {
3008
- next: function () {
3009
- if (o && i >= o.length) o = void 0;
3010
- return { value: o && o[i++], done: !o };
3011
- }
3012
- };
3013
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3014
- }
3015
-
3016
- function __read(o, n) {
3017
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3018
- if (!m) return o;
3019
- var i = m.call(o), r, ar = [], e;
3020
- try {
3021
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3022
- }
3023
- catch (error) { e = { error: error }; }
3024
- finally {
3025
- try {
3026
- if (r && !r.done && (m = i["return"])) m.call(i);
3027
- }
3028
- finally { if (e) throw e.error; }
3029
- }
3030
- return ar;
3031
- }
3032
-
3033
- function __spreadArray(to, from) {
3034
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
3035
- to[j] = from[i];
3036
- return to;
3037
- }
3038
-
3039
3028
  function isFunction$1(value) {
3040
3029
  return typeof value === 'function';
3041
3030
  }
@@ -3444,16 +3433,20 @@ var Observable = (function () {
3444
3433
  var _this = this;
3445
3434
  promiseCtor = getPromiseCtor(promiseCtor);
3446
3435
  return new promiseCtor(function (resolve, reject) {
3447
- var subscription;
3448
- subscription = _this.subscribe(function (value) {
3449
- try {
3450
- next(value);
3451
- }
3452
- catch (err) {
3453
- reject(err);
3454
- subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
3455
- }
3456
- }, reject, resolve);
3436
+ var subscriber = new SafeSubscriber({
3437
+ next: function (value) {
3438
+ try {
3439
+ next(value);
3440
+ }
3441
+ catch (err) {
3442
+ reject(err);
3443
+ subscriber.unsubscribe();
3444
+ }
3445
+ },
3446
+ error: reject,
3447
+ complete: resolve,
3448
+ });
3449
+ _this.subscribe(subscriber);
3457
3450
  });
3458
3451
  };
3459
3452
  Observable.prototype._subscribe = function (subscriber) {
@@ -3834,19 +3827,167 @@ var jsonRpc = {};
3834
3827
 
3835
3828
  var object = {};
3836
3829
 
3837
- object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
3830
+ /**
3831
+ * lodash (Custom Build) <https://lodash.com/>
3832
+ * Build: `lodash modularize exports="npm" -o ./`
3833
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
3834
+ * Released under MIT license <https://lodash.com/license>
3835
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
3836
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3837
+ */
3838
+
3839
+ /** `Object#toString` result references. */
3840
+ var objectTag = '[object Object]';
3841
+
3842
+ /**
3843
+ * Checks if `value` is a host object in IE < 9.
3844
+ *
3845
+ * @private
3846
+ * @param {*} value The value to check.
3847
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
3848
+ */
3849
+ function isHostObject(value) {
3850
+ // Many host objects are `Object` objects that can coerce to strings
3851
+ // despite having improperly defined `toString` methods.
3852
+ var result = false;
3853
+ if (value != null && typeof value.toString != 'function') {
3854
+ try {
3855
+ result = !!(value + '');
3856
+ } catch (e) {}
3857
+ }
3858
+ return result;
3859
+ }
3860
+
3861
+ /**
3862
+ * Creates a unary function that invokes `func` with its argument transformed.
3863
+ *
3864
+ * @private
3865
+ * @param {Function} func The function to wrap.
3866
+ * @param {Function} transform The argument transform.
3867
+ * @returns {Function} Returns the new function.
3868
+ */
3869
+ function overArg(func, transform) {
3870
+ return function(arg) {
3871
+ return func(transform(arg));
3872
+ };
3873
+ }
3874
+
3875
+ /** Used for built-in method references. */
3876
+ var funcProto = Function.prototype,
3877
+ objectProto = Object.prototype;
3878
+
3879
+ /** Used to resolve the decompiled source of functions. */
3880
+ var funcToString = funcProto.toString;
3881
+
3882
+ /** Used to check objects for own properties. */
3883
+ var hasOwnProperty = objectProto.hasOwnProperty;
3884
+
3885
+ /** Used to infer the `Object` constructor. */
3886
+ var objectCtorString = funcToString.call(Object);
3887
+
3888
+ /**
3889
+ * Used to resolve the
3890
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
3891
+ * of values.
3892
+ */
3893
+ var objectToString = objectProto.toString;
3894
+
3895
+ /** Built-in value references. */
3896
+ var getPrototype = overArg(Object.getPrototypeOf, Object);
3897
+
3898
+ /**
3899
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
3900
+ * and has a `typeof` result of "object".
3901
+ *
3902
+ * @static
3903
+ * @memberOf _
3904
+ * @since 4.0.0
3905
+ * @category Lang
3906
+ * @param {*} value The value to check.
3907
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3908
+ * @example
3909
+ *
3910
+ * _.isObjectLike({});
3911
+ * // => true
3912
+ *
3913
+ * _.isObjectLike([1, 2, 3]);
3914
+ * // => true
3915
+ *
3916
+ * _.isObjectLike(_.noop);
3917
+ * // => false
3918
+ *
3919
+ * _.isObjectLike(null);
3920
+ * // => false
3921
+ */
3922
+ function isObjectLike(value) {
3923
+ return !!value && typeof value == 'object';
3924
+ }
3925
+
3926
+ /**
3927
+ * Checks if `value` is a plain object, that is, an object created by the
3928
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
3929
+ *
3930
+ * @static
3931
+ * @memberOf _
3932
+ * @since 0.8.0
3933
+ * @category Lang
3934
+ * @param {*} value The value to check.
3935
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
3936
+ * @example
3937
+ *
3938
+ * function Foo() {
3939
+ * this.a = 1;
3940
+ * }
3941
+ *
3942
+ * _.isPlainObject(new Foo);
3943
+ * // => false
3944
+ *
3945
+ * _.isPlainObject([1, 2, 3]);
3946
+ * // => false
3947
+ *
3948
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
3949
+ * // => true
3950
+ *
3951
+ * _.isPlainObject(Object.create(null));
3952
+ * // => true
3953
+ */
3954
+ function isPlainObject$1(value) {
3955
+ if (!isObjectLike(value) ||
3956
+ objectToString.call(value) != objectTag || isHostObject(value)) {
3957
+ return false;
3958
+ }
3959
+ var proto = getPrototype(value);
3960
+ if (proto === null) {
3961
+ return true;
3962
+ }
3963
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
3964
+ return (typeof Ctor == 'function' &&
3965
+ Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
3966
+ }
3967
+
3968
+ var lodash_isplainobject = isPlainObject$1;
3969
+
3970
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
3971
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3972
+ };object.isntEmptyObject = object.isEmptyObject = object.isntPlainObject = object.isPlainObject = object.isntObject = object.isObject = void 0;
3973
+ const lodash_isplainobject_1 = __importDefault(lodash_isplainobject);
3838
3974
  function isObject(val) {
3839
- return val !== null && typeof val === 'object';
3975
+ return val !== null
3976
+ && typeof val === 'object';
3840
3977
  }
3841
3978
  object.isObject = isObject;
3842
3979
  function isntObject(val) {
3843
3980
  return !isObject(val);
3844
3981
  }
3845
3982
  object.isntObject = isntObject;
3846
- function isRecord(val) {
3847
- return isObject(val);
3983
+ function isPlainObject(val) {
3984
+ return (0, lodash_isplainobject_1.default)(val);
3985
+ }
3986
+ object.isPlainObject = isPlainObject;
3987
+ function isntPlainObject(val) {
3988
+ return !isPlainObject(val);
3848
3989
  }
3849
- object.isRecord = isRecord;
3990
+ object.isntPlainObject = isntPlainObject;
3850
3991
  function isEmptyObject(val) {
3851
3992
  return Object.keys(val).length === 0;
3852
3993
  }
@@ -3881,7 +4022,7 @@ function isJsonRpcParams(val) {
3881
4022
  return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
3882
4023
  }
3883
4024
  function isJsonRpcNotification(val) {
3884
- return (0, object_1.isRecord)(val)
4025
+ return (0, object_1.isPlainObject)(val)
3885
4026
  && (0, string_1.isString)(val.jsonrpc)
3886
4027
  && (0, string_1.isString)(val.method)
3887
4028
  && (0, undefined_1.isUndefined)(val.id)
@@ -3893,7 +4034,7 @@ function isntJsonRpcNotification(val) {
3893
4034
  }
3894
4035
  jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
3895
4036
  function isJsonRpcRequest(val) {
3896
- return (0, object_1.isRecord)(val)
4037
+ return (0, object_1.isPlainObject)(val)
3897
4038
  && (0, string_1.isString)(val.jsonrpc)
3898
4039
  && (0, string_1.isString)(val.method)
3899
4040
  && isJsonRpcId(val.id)
@@ -3905,7 +4046,7 @@ function isntJsonRpcRequest(val) {
3905
4046
  }
3906
4047
  jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
3907
4048
  function isJsonRpcSuccess(val) {
3908
- return (0, object_1.isRecord)(val)
4049
+ return (0, object_1.isPlainObject)(val)
3909
4050
  && (0, string_1.isString)(val.jsonrpc)
3910
4051
  && (0, string_1.isString)(val.id)
3911
4052
  && 'result' in val;
@@ -3916,7 +4057,7 @@ function isntJsonRpcSuccess(val) {
3916
4057
  }
3917
4058
  jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
3918
4059
  function isJsonRpcError(val) {
3919
- return (0, object_1.isRecord)(val)
4060
+ return (0, object_1.isPlainObject)(val)
3920
4061
  && (0, string_1.isString)(val.jsonrpc)
3921
4062
  && isJsonRpcId(val.id)
3922
4063
  && isJsonRpcErrorObject(val.error);
@@ -3927,7 +4068,7 @@ function isntJsonRpcError(val) {
3927
4068
  }
3928
4069
  jsonRpc.isntJsonRpcError = isntJsonRpcError;
3929
4070
  function isJsonRpcErrorObject(val) {
3930
- return (0, object_1.isRecord)(val)
4071
+ return (0, object_1.isPlainObject)(val)
3931
4072
  && (0, number_1.isNumber)(val.code)
3932
4073
  && (0, string_1.isString)(val.message)
3933
4074
  && ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));