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