mnemonica 0.9.937 → 0.9.942

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.bindedMethodErrorHandler = void 0;
4
4
  const constants_1 = require('../../constants');
5
5
  const { odp, } = constants_1.constants;
6
- exports.bindedMethodErrorHandler = (exceptionReason) => {
6
+ const bindedMethodErrorHandler = (exceptionReason) => {
7
7
  const { applyTo, args, method, asNew, error } = exceptionReason;
8
8
  const reThrown = error.exceptionReason !== undefined;
9
9
  if (reThrown) {
@@ -53,3 +53,4 @@ exports.bindedMethodErrorHandler = (exceptionReason) => {
53
53
  }
54
54
  return error;
55
55
  };
56
+ exports.bindedMethodErrorHandler = bindedMethodErrorHandler;
@@ -83,7 +83,7 @@ const exceptionConsctructHandler = function (opts) {
83
83
  });
84
84
  stack.push('\n<-- of constructor definitions stack -->');
85
85
  stack.push(...typeStack);
86
- exception.stack = errors_2.cleanupStack(stack).join('\n');
86
+ exception.stack = (0, errors_2.cleanupStack)(stack).join('\n');
87
87
  return exception;
88
88
  };
89
89
  const prepareException = function (target, error, ...args) {
@@ -104,7 +104,7 @@ const prepareException = function (target, error, ...args) {
104
104
  error
105
105
  });
106
106
  });
107
- ExceptionCreator.InstanceModificator = InstanceModificator_1.makeInstanceModificator(ExceptionCreator);
107
+ ExceptionCreator.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(ExceptionCreator);
108
108
  return new ExceptionCreator.InstanceModificator();
109
109
  };
110
110
  exports.default = prepareException;
@@ -5,7 +5,7 @@ const constants_1 = require('../../constants');
5
5
  const { odp, SymbolConstructorName, MNEMONICA, ErrorMessages, } = constants_1.constants;
6
6
  const { BASE_ERROR_MESSAGE } = ErrorMessages;
7
7
  exports.stackCleaners = [];
8
- exports.cleanupStack = (stack) => {
8
+ const cleanupStack = (stack) => {
9
9
  const cleaned = stack.reduce((arr, line) => {
10
10
  exports.stackCleaners.forEach(cleanerRegExp => {
11
11
  if (!cleanerRegExp.test(line)) {
@@ -16,7 +16,8 @@ exports.cleanupStack = (stack) => {
16
16
  }, []);
17
17
  return cleaned.length ? cleaned : stack;
18
18
  };
19
- exports.getStack = function (title, stackAddition, tillFunction) {
19
+ exports.cleanupStack = cleanupStack;
20
+ const getStack = function (title, stackAddition, tillFunction) {
20
21
  if (Error.captureStackTrace) {
21
22
  Error.captureStackTrace(this, tillFunction || exports.getStack);
22
23
  }
@@ -24,7 +25,7 @@ exports.getStack = function (title, stackAddition, tillFunction) {
24
25
  this.stack = (new Error()).stack;
25
26
  }
26
27
  this.stack = this.stack.split('\n').slice(1);
27
- this.stack = exports.cleanupStack(this.stack);
28
+ this.stack = (0, exports.cleanupStack)(this.stack);
28
29
  this.stack.unshift(title);
29
30
  if (Array.isArray(stackAddition) && stackAddition.length) {
30
31
  this.stack.push(...stackAddition);
@@ -32,6 +33,7 @@ exports.getStack = function (title, stackAddition, tillFunction) {
32
33
  this.stack.push('\n');
33
34
  return this.stack;
34
35
  };
36
+ exports.getStack = getStack;
35
37
  class BASE_MNEMONICA_ERROR extends Error {
36
38
  constructor (message = BASE_ERROR_MESSAGE, additionalStack) {
37
39
  super(message);
@@ -41,7 +43,7 @@ class BASE_MNEMONICA_ERROR extends Error {
41
43
  return BaseStack;
42
44
  }
43
45
  });
44
- const stack = exports.cleanupStack(BaseStack.split('\n'));
46
+ const stack = (0, exports.cleanupStack)(BaseStack.split('\n'));
45
47
  if (additionalStack) {
46
48
  stack.unshift(...additionalStack);
47
49
  }
@@ -52,7 +54,7 @@ class BASE_MNEMONICA_ERROR extends Error {
52
54
  }
53
55
  }
54
56
  exports.BASE_MNEMONICA_ERROR = BASE_MNEMONICA_ERROR;
55
- exports.constructError = (name, message) => {
57
+ const constructError = (name, message) => {
56
58
  const body = `
57
59
  class ${name} extends base {
58
60
  constructor (addition, stack) {
@@ -68,3 +70,4 @@ exports.constructError = (name, message) => {
68
70
  const ErrorConstructor = (new Function('base', body))(BASE_MNEMONICA_ERROR);
69
71
  return ErrorConstructor;
70
72
  };
73
+ exports.constructError = constructError;
@@ -11,7 +11,7 @@ const { makeFakeModificatorType } = utils_1.default;
11
11
  const utils_2 = require('../../utils');
12
12
  const { parse } = utils_2.utils;
13
13
  const InstanceModificator_1 = require('../types/InstanceModificator');
14
- exports.throwModificationError = function (error) {
14
+ const throwModificationError = function (error) {
15
15
  const self = this;
16
16
  const { TypeName, type: { stack: typeStack }, args } = self;
17
17
  const exceptionReason = error.exceptionReason || error;
@@ -41,7 +41,7 @@ exports.throwModificationError = function (error) {
41
41
  enumerable : true
42
42
  });
43
43
  self.ModificatorType = makeFakeModificatorType(TypeName);
44
- self.InstanceModificator = InstanceModificator_1.makeInstanceModificator(self);
44
+ self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
45
45
  const erroredInstance = new self.InstanceModificator();
46
46
  erroredInstance[SymbolReplaceGaia](error);
47
47
  const stack = [];
@@ -62,7 +62,7 @@ exports.throwModificationError = function (error) {
62
62
  stack.push('\n<-- of constructor definitions stack -->');
63
63
  stack.push(...typeStack);
64
64
  }
65
- erroredInstance.stack = _1.cleanupStack(stack).join('\n');
65
+ erroredInstance.stack = (0, _1.cleanupStack)(stack).join('\n');
66
66
  self.inheritedInstance = erroredInstance;
67
67
  const results = self.invokePostHooks();
68
68
  const { type, collection, namespace } = results;
@@ -100,3 +100,4 @@ exports.throwModificationError = function (error) {
100
100
  });
101
101
  throw erroredInstance;
102
102
  };
103
+ exports.throwModificationError = throwModificationError;
@@ -4,7 +4,7 @@ exports.registerFlowChecker = exports.flowCheckers = void 0;
4
4
  const errors_1 = require('../../descriptors/errors');
5
5
  const { MISSING_CALLBACK_ARGUMENT, FLOW_CHECKER_REDEFINITION, } = errors_1.ErrorsTypes;
6
6
  exports.flowCheckers = new WeakMap();
7
- exports.registerFlowChecker = function (cb) {
7
+ const registerFlowChecker = function (cb) {
8
8
  if (typeof cb !== 'function') {
9
9
  throw new MISSING_CALLBACK_ARGUMENT;
10
10
  }
@@ -13,3 +13,4 @@ exports.registerFlowChecker = function (cb) {
13
13
  }
14
14
  exports.flowCheckers.set(this, cb);
15
15
  };
16
+ exports.registerFlowChecker = registerFlowChecker;
@@ -5,11 +5,11 @@ const constants_1 = require('../../constants');
5
5
  const { MNEMONICA, } = constants_1.constants;
6
6
  const flowCheckers_1 = require('./flowCheckers');
7
7
  const hop_1 = require('../../utils/hop');
8
- exports.invokeHook = function (hookType, opts) {
8
+ const invokeHook = function (hookType, opts) {
9
9
  const { type, existentInstance, inheritedInstance, args, creator } = opts;
10
10
  const invocationResults = new Set();
11
11
  const self = this;
12
- if (hop_1.hop(self.hooks, hookType)) {
12
+ if ((0, hop_1.hop)(self.hooks, hookType)) {
13
13
  const { TypeName, } = type;
14
14
  const hookArgs = {
15
15
  type,
@@ -47,3 +47,4 @@ exports.invokeHook = function (hookType, opts) {
47
47
  }
48
48
  return invocationResults;
49
49
  };
50
+ exports.invokeHook = invokeHook;
@@ -8,7 +8,7 @@ const hooksTypes = [
8
8
  'postCreation',
9
9
  'creationError',
10
10
  ];
11
- exports.registerHook = function (hookType, cb) {
11
+ const registerHook = function (hookType, cb) {
12
12
  if (!hooksTypes.includes(hookType)) {
13
13
  throw new WRONG_HOOK_TYPE;
14
14
  }
@@ -22,3 +22,4 @@ exports.registerHook = function (hookType, cb) {
22
22
  this.hooks[hookType].add(cb);
23
23
  }
24
24
  };
25
+ exports.registerHook = registerHook;
@@ -76,7 +76,7 @@ const bindMethod = function (instance, methodName, MethodItself) {
76
76
  value : error,
77
77
  enumerable : true
78
78
  });
79
- throw bindedMethodErrorHandler_1.bindedMethodErrorHandler(exceptionReason);
79
+ throw (0, bindedMethodErrorHandler_1.bindedMethodErrorHandler)(exceptionReason);
80
80
  });
81
81
  }
82
82
  return answer;
@@ -86,7 +86,7 @@ const bindMethod = function (instance, methodName, MethodItself) {
86
86
  value : error,
87
87
  enumerable : true
88
88
  });
89
- throw bindedMethodErrorHandler_1.bindedMethodErrorHandler(exceptionReason);
89
+ throw (0, bindedMethodErrorHandler_1.bindedMethodErrorHandler)(exceptionReason);
90
90
  }
91
91
  };
92
92
  },
@@ -231,11 +231,11 @@ exports.InstanceCreator = function (type, existentInstance, args, chained) {
231
231
  }
232
232
  if (blockErrors && existentInstance instanceof Error) {
233
233
  self.ModificatorType = makeFakeModificatorType(TypeName);
234
- self.InstanceModificator = InstanceModificator_1.makeInstanceModificator(self);
234
+ self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
235
235
  throw new self.InstanceModificator(...args);
236
236
  }
237
237
  self.invokePreHooks();
238
- self.InstanceModificator = InstanceModificator_1.makeInstanceModificator(self);
238
+ self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
239
239
  if (blockErrors) {
240
240
  try {
241
241
  self.inheritedInstance = new self.InstanceModificator(...args);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.makeInstanceModificator = void 0;
4
4
  const addProps_1 = require('./addProps');
5
- exports.makeInstanceModificator = (self) => {
5
+ const makeInstanceModificator = (self) => {
6
6
  const { ModificationConstructor, existentInstance, ModificatorType, proto, } = self;
7
7
  const result = ModificationConstructor.call(existentInstance, ModificatorType, Object.assign({}, proto), (__proto_proto__) => {
8
8
  self.__proto_proto__ = __proto_proto__;
@@ -10,3 +10,4 @@ exports.makeInstanceModificator = (self) => {
10
10
  });
11
11
  return result;
12
12
  };
13
+ exports.makeInstanceModificator = makeInstanceModificator;
@@ -2,7 +2,7 @@ import { ConstructorFunction } from '../../types';
2
2
  declare const _default: {
3
3
  Gaia: ConstructorFunction<{}>;
4
4
  Mnemosyne: ConstructorFunction<{
5
- [x: string]: (this: any) => any;
5
+ [x: symbol]: (() => (this: any, uranus: any) => void) | (() => string);
6
6
  extract(): (this: any) => {
7
7
  [index: string]: any;
8
8
  };
@@ -24,17 +24,17 @@ const Gaia = function (Uranus) {
24
24
  const MnemonicaProtoProps = {
25
25
  extract () {
26
26
  return function () {
27
- return extract_1.extract(this);
27
+ return (0, extract_1.extract)(this);
28
28
  };
29
29
  },
30
30
  pick () {
31
31
  return function (...args) {
32
- return pick_1.pick(this, ...args);
32
+ return (0, pick_1.pick)(this, ...args);
33
33
  };
34
34
  },
35
35
  parent () {
36
36
  return function (constructorLookupPath) {
37
- return parent_1.parent(this, constructorLookupPath);
37
+ return (0, parent_1.parent)(this, constructorLookupPath);
38
38
  };
39
39
  },
40
40
  clone () {
@@ -28,7 +28,7 @@ exports.TypeProxy.prototype.get = function (target, prop) {
28
28
  if (propDeclaration) {
29
29
  return propDeclaration;
30
30
  }
31
- if (hop_1.hop(type, prop)) {
31
+ if ((0, hop_1.hop)(type, prop)) {
32
32
  return propDeclaration;
33
33
  }
34
34
  if (type.subtypes.has(prop)) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.addProps = void 0;
4
4
  const constants_1 = require('../../constants');
5
5
  const { odp, } = constants_1.constants;
6
- exports.addProps = function () {
6
+ const addProps = function () {
7
7
  const self = this;
8
8
  const { type, existentInstance, args, config: { submitStack }, __proto_proto__: proto } = self;
9
9
  const { namespace, collection, subtypes, } = type;
@@ -62,6 +62,7 @@ exports.addProps = function () {
62
62
  }
63
63
  });
64
64
  };
65
+ exports.addProps = addProps;
65
66
  module.exports = {
66
67
  addProps : exports.addProps
67
68
  };
@@ -21,7 +21,7 @@ function default_1 () {
21
21
  });
22
22
  ModificatorType.prototype.constructor = ModificatorType;
23
23
  Reflect.setPrototypeOf(ModificatorType.prototype, Mnemosyne);
24
- obeyConstructor_1.obey(existentInstance, ModificatorType);
24
+ (0, obeyConstructor_1.obey)(existentInstance, ModificatorType);
25
25
  return ModificatorType;
26
26
  };
27
27
  return CreateInstanceModificator;
@@ -17,7 +17,7 @@ function default_1 () {
17
17
  },
18
18
  enumerable : false
19
19
  });
20
- obeyConstructor_1.obey(existentInstance, ModificatorType);
20
+ (0, obeyConstructor_1.obey)(existentInstance, ModificatorType);
21
21
  return ModificatorType;
22
22
  };
23
23
  Inherico.prototype = Mnemosyne;
@@ -112,10 +112,10 @@ const defineFromFunction = function (subtypes, TypeName, constructHandler = func
112
112
  throw new HANDLER_MUST_BE_A_FUNCTION;
113
113
  }
114
114
  const asClass = isClass(constructHandler);
115
- const modificatorBody = compileNewModificatorFunctionBody_1.default(TypeName, asClass);
115
+ const modificatorBody = (0, compileNewModificatorFunctionBody_1.default)(TypeName, asClass);
116
116
  const makeConstructHandler = modificatorBody(constructHandler, CreationHandler, SymbolConstructorName);
117
117
  if (!proto) {
118
- if (hop_1.hop(constructHandler, 'prototype')) {
118
+ if ((0, hop_1.hop)(constructHandler, 'prototype')) {
119
119
  proto = Object.assign({}, constructHandler.prototype);
120
120
  }
121
121
  else {
@@ -136,7 +136,7 @@ const defineFromFunction = function (subtypes, TypeName, constructHandler = func
136
136
  config.asClass = asClass;
137
137
  return new TypeDescriptor(this, subtypes, TypeName, makeConstructHandler, proto, config);
138
138
  };
139
- exports.define = function (subtypes, TypeOrTypeName, constructHandlerOrConfig, proto, config) {
139
+ const define = function (subtypes, TypeOrTypeName, constructHandlerOrConfig, proto, config) {
140
140
  if (typeof TypeOrTypeName === 'function') {
141
141
  if (TypeOrTypeName.name) {
142
142
  return exports.define.call(this, subtypes, TypeOrTypeName.name, TypeOrTypeName, constructHandlerOrConfig || TypeOrTypeName.prototype, config);
@@ -163,7 +163,8 @@ exports.define = function (subtypes, TypeOrTypeName, constructHandlerOrConfig, p
163
163
  }
164
164
  throw new WRONG_TYPE_DEFINITION('definition is not provided');
165
165
  };
166
- exports.lookup = function (TypeNestedPath) {
166
+ exports.define = define;
167
+ const lookup = function (TypeNestedPath) {
167
168
  if (typeof TypeNestedPath !== 'string') {
168
169
  throw new WRONG_TYPE_DEFINITION('arg : type nested path must be a string');
169
170
  }
@@ -179,3 +180,4 @@ exports.lookup = function (TypeNestedPath) {
179
180
  const NextNestedPath = split.slice(1).join('.');
180
181
  return exports.lookup.call(type.subtypes, NextNestedPath);
181
182
  };
183
+ exports.lookup = lookup;
@@ -5,7 +5,7 @@ const constants_1 = require('../../constants');
5
5
  const { SymbolUsed } = constants_1.constants;
6
6
  const errors_1 = require('../../descriptors/errors');
7
7
  const { PROTOTYPE_USED_TWICE, } = errors_1.ErrorsTypes;
8
- exports.obey = (existentInstance, ModificatorType) => {
8
+ const obey = (existentInstance, ModificatorType) => {
9
9
  let protoConstructor = ModificatorType;
10
10
  while (protoConstructor instanceof Function) {
11
11
  if (Object.prototype.hasOwnProperty.call(protoConstructor, SymbolUsed) && protoConstructor[SymbolUsed]) {
@@ -27,3 +27,4 @@ exports.obey = (existentInstance, ModificatorType) => {
27
27
  }
28
28
  Reflect.setPrototypeOf(protoConstructor, existentInstance.constructor);
29
29
  };
30
+ exports.obey = obey;
@@ -109,7 +109,7 @@ const isClass = (fn) => {
109
109
  return Reflect.getOwnPropertyDescriptor(fn, 'prototype').writable === false;
110
110
  };
111
111
  const makeFakeModificatorType = (TypeName, fakeModificator = function () { }) => {
112
- const modificatorBody = compileNewModificatorFunctionBody_1.default(TypeName);
112
+ const modificatorBody = (0, compileNewModificatorFunctionBody_1.default)(TypeName);
113
113
  const modificatorType = modificatorBody(fakeModificator, CreationHandler, SymbolConstructorName);
114
114
  return modificatorType();
115
115
  };
@@ -9,6 +9,6 @@ exports.ErrorsTypes = {
9
9
  };
10
10
  Object.entries(ErrorMessages).forEach(entry => {
11
11
  const [ErrorConstructorName, message] = entry;
12
- const ErrorConstructor = errors_1.constructError(ErrorConstructorName, message);
12
+ const ErrorConstructor = (0, errors_1.constructError)(ErrorConstructorName, message);
13
13
  exports.ErrorsTypes[ErrorConstructorName] = ErrorConstructor;
14
14
  });
@@ -136,7 +136,7 @@ const typesCollectionProxyHandler = {
136
136
  };
137
137
  const createTypesCollection = (namespace = defaultNamespace, association, config = {}) => {
138
138
  if (!(namespace instanceof Object) ||
139
- !hop_1.hop(namespace, 'name') ||
139
+ !(0, hop_1.hop)(namespace, 'name') ||
140
140
  !namespaces_1.namespaces.namespaces.has(namespace.name)) {
141
141
  throw new NAMESPACE_DOES_NOT_EXIST;
142
142
  }
package/build/index.d.ts CHANGED
@@ -5,9 +5,9 @@ export declare const define: TypeAbsorber;
5
5
  export declare const tsdefine: <T>(this: any, TypeName: string, constructHandler: IDEF<T>, proto?: object | undefined, config?: object | undefined) => ITypeClass<T>;
6
6
  export declare const lookup: TypeLookup;
7
7
  export declare const mnemonica: {
8
- [index: string]: any;
8
+ [index: string]: unknown;
9
9
  };
10
- export declare const SymbolSubtypeCollection: any, SymbolConstructorName: any, SymbolGaia: any, SymbolReplaceGaia: any, SymbolDefaultNamespace: any, SymbolDefaultTypesCollection: any, SymbolConfig: any, MNEMONICA: any, MNEMOSYNE: any, GAIA: any, URANUS: any, TYPE_TITLE_PREFIX: any, ErrorMessages: any, createNamespace: any, namespaces: any, defaultNamespace: any, createTypesCollection: any;
10
+ export declare const SymbolSubtypeCollection: unknown, SymbolConstructorName: unknown, SymbolGaia: unknown, SymbolReplaceGaia: unknown, SymbolDefaultNamespace: unknown, SymbolDefaultTypesCollection: unknown, SymbolConfig: unknown, MNEMONICA: unknown, MNEMOSYNE: unknown, GAIA: unknown, URANUS: unknown, TYPE_TITLE_PREFIX: unknown, ErrorMessages: unknown, createNamespace: unknown, namespaces: unknown, defaultNamespace: unknown, createTypesCollection: unknown;
11
11
  export declare const defaultCollection: any;
12
12
  export declare const errors: any;
13
13
  export { utils } from './utils';
package/build/index.js CHANGED
@@ -15,9 +15,10 @@ exports.define = function (TypeName, constructHandler, proto, config) {
15
15
  const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
16
16
  return types.define(TypeName, constructHandler, proto, config);
17
17
  };
18
- exports.tsdefine = function (TypeName, constructHandler, proto, config) {
18
+ const tsdefine = function (TypeName, constructHandler, proto, config) {
19
19
  return exports.defaultTypes.define(TypeName, constructHandler, proto, config);
20
20
  };
21
+ exports.tsdefine = tsdefine;
21
22
  exports.lookup = function (TypeNestedPath) {
22
23
  const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
23
24
  return types.lookup(TypeNestedPath);
@@ -14,7 +14,7 @@ const getAdditor = (constructors) => {
14
14
  const getAccumulator = (asSequence) => {
15
15
  return asSequence ? [] : {};
16
16
  };
17
- exports.collectConstructors = (self, asSequence = false) => {
17
+ const collectConstructors = (self, asSequence = false) => {
18
18
  const constructors = getAccumulator(asSequence);
19
19
  const addToSequence = getAdditor(constructors);
20
20
  if (typeof self === 'object') {
@@ -57,3 +57,4 @@ exports.collectConstructors = (self, asSequence = false) => {
57
57
  }
58
58
  return constructors;
59
59
  };
60
+ exports.collectConstructors = collectConstructors;
@@ -4,9 +4,10 @@ exports.defineStackCleaner = void 0;
4
4
  const errors_1 = require('../descriptors/errors');
5
5
  const errors_2 = require('../api/errors');
6
6
  const { WRONG_STACK_CLEANER } = errors_1.ErrorsTypes;
7
- exports.defineStackCleaner = (regexp) => {
7
+ const defineStackCleaner = (regexp) => {
8
8
  if (!(regexp instanceof RegExp)) {
9
9
  throw new WRONG_STACK_CLEANER;
10
10
  }
11
11
  errors_2.stackCleaners.push(regexp);
12
12
  };
13
+ exports.defineStackCleaner = defineStackCleaner;
@@ -4,16 +4,17 @@ exports.extract = void 0;
4
4
  const errors_1 = require('../descriptors/errors');
5
5
  const { WRONG_INSTANCE_INVOCATION } = errors_1.ErrorsTypes;
6
6
  const hop_1 = require('./hop');
7
- exports.extract = (instance) => {
7
+ const extract = (instance) => {
8
8
  if (instance !== Object(instance)) {
9
9
  throw new WRONG_INSTANCE_INVOCATION;
10
10
  }
11
11
  const extracted = {};
12
12
  for (const name in instance) {
13
- if (name === 'constructor' && !hop_1.hop(instance, name)) {
13
+ if (name === 'constructor' && !(0, hop_1.hop)(instance, name)) {
14
14
  continue;
15
15
  }
16
16
  extracted[name] = instance[name];
17
17
  }
18
18
  return extracted;
19
19
  };
20
+ exports.extract = extract;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.hop = void 0;
4
- exports.hop = (o, p) => Object.prototype.hasOwnProperty.call(o, p);
4
+ const hop = (o, p) => Object.prototype.hasOwnProperty.call(o, p);
5
+ exports.hop = hop;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.merge = void 0;
4
4
  const errors_1 = require('../descriptors/errors');
5
5
  const { WRONG_ARGUMENTS_USED } = errors_1.ErrorsTypes;
6
- exports.merge = (a, b, ...args) => {
6
+ const merge = (a, b, ...args) => {
7
7
  if (a !== Object(a)) {
8
8
  throw new WRONG_ARGUMENTS_USED('A should be an object');
9
9
  }
@@ -16,3 +16,4 @@ exports.merge = (a, b, ...args) => {
16
16
  const aa = a.fork.call(b, ...args);
17
17
  return aa;
18
18
  };
19
+ exports.merge = merge;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.parent = void 0;
4
4
  const errors_1 = require('../descriptors/errors');
5
5
  const { WRONG_INSTANCE_INVOCATION } = errors_1.ErrorsTypes;
6
- exports.parent = (instance, path) => {
6
+ const parent = (instance, path) => {
7
7
  if (instance !== Object(instance)) {
8
8
  throw new WRONG_INSTANCE_INVOCATION;
9
9
  }
@@ -16,5 +16,6 @@ exports.parent = (instance, path) => {
16
16
  }
17
17
  const { constructor: { name } } = p;
18
18
  return name === path ?
19
- p : exports.parent(p, path);
19
+ p : (0, exports.parent)(p, path);
20
20
  };
21
+ exports.parent = parent;
@@ -7,7 +7,7 @@ const constants_1 = require('../constants');
7
7
  const { SymbolGaia } = constants_1.constants;
8
8
  const extract_1 = require('./extract');
9
9
  const hop_1 = require('./hop');
10
- exports.parse = (self) => {
10
+ const parse = (self) => {
11
11
  if (!self || !self.constructor) {
12
12
  throw new WRONG_MODIFICATION_PATTERN;
13
13
  }
@@ -20,18 +20,18 @@ exports.parse = (self) => {
20
20
  throw new WRONG_ARGUMENTS_USED(`have to use "instance" itself: '${proto.constructor.name}' vs '${protoProto.constructor.name}'`);
21
21
  }
22
22
  const { name } = proto.constructor;
23
- const props = extract_1.extract(Object.assign({}, self));
23
+ const props = (0, extract_1.extract)(Object.assign({}, self));
24
24
  delete props.constructor;
25
- const joint = extract_1.extract(Object.assign({}, proto));
25
+ const joint = (0, extract_1.extract)(Object.assign({}, proto));
26
26
  delete joint.constructor;
27
27
  let parent;
28
28
  let gaia;
29
- if (hop_1.hop(protoProto, SymbolGaia)) {
29
+ if ((0, hop_1.hop)(protoProto, SymbolGaia)) {
30
30
  parent = protoProto;
31
31
  gaia = self[SymbolGaia];
32
32
  }
33
33
  else {
34
- parent = exports.parse(Reflect.getPrototypeOf(protoProto));
34
+ parent = (0, exports.parse)(Reflect.getPrototypeOf(protoProto));
35
35
  gaia = parent.gaia;
36
36
  }
37
37
  return {
@@ -44,3 +44,4 @@ exports.parse = (self) => {
44
44
  gaia
45
45
  };
46
46
  };
47
+ exports.parse = parse;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.pick = void 0;
4
4
  const errors_1 = require('../descriptors/errors');
5
5
  const { WRONG_INSTANCE_INVOCATION } = errors_1.ErrorsTypes;
6
- exports.pick = (instance, ...args) => {
6
+ const pick = (instance, ...args) => {
7
7
  if (instance !== Object(instance)) {
8
8
  throw new WRONG_INSTANCE_INVOCATION;
9
9
  }
@@ -22,3 +22,4 @@ exports.pick = (instance, ...args) => {
22
22
  }, {});
23
23
  return picked;
24
24
  };
25
+ exports.pick = pick;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.toJSON = void 0;
4
4
  const extract_1 = require('./extract');
5
- exports.toJSON = (instance) => {
6
- const extracted = extract_1.extract(instance);
5
+ const toJSON = (instance) => {
6
+ const extracted = (0, extract_1.extract)(instance);
7
7
  return Object.entries(extracted).reduce((o, entry) => {
8
8
  const [name, _value] = entry;
9
9
  if ([null, undefined].includes(_value)) {
@@ -27,3 +27,4 @@ exports.toJSON = (instance) => {
27
27
  }, '{')
28
28
  .replace(/,$/, '}');
29
29
  };
30
+ exports.toJSON = toJSON;
package/package.json CHANGED
@@ -1,94 +1,97 @@
1
1
  {
2
- "name": "mnemonica",
3
- "version": "0.9.937",
4
- "description": "abstract technique that aids information retention : instance inheritance system",
5
- "type": "commonjs",
6
- "main": "./build/index.js",
7
- "exports": {
8
- ".": "./build/index.js",
9
- "./module": {
10
- "import": "./module/index.js",
11
- "browser": "./module/index.js",
12
- "require": "./build/index.js",
13
- "default": "./build/index.js"
14
- }
15
- },
16
- "files": [
17
- "README.md",
18
- "LICENSE",
19
- "module",
20
- "build"
21
- ],
22
- "directories": {
23
- "build": "build/",
24
- "module": "module/"
25
- },
26
- "contributors": [
27
- "laplandin <laplandin.denis@gmail.com>",
28
- "petrgrishin <iam@petrgrishin.com>",
29
- "Goodluckhf <Goodluckhf@yandex.ru>"
30
- ],
31
- "scripts": {
32
- "build": "rm -rf ./build && npx tsc --pretty && npm run lint && npm run lint:test",
33
- "watch": "npx tsc --pretty -w",
34
- "test": "npm run build && mocha --allow-uncaught test/index.js",
35
- "test:cov:dev": "npm run build && nyc --reporter=text mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
36
- "test:cov": "npm run build && nyc --reporter=lcov mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
37
- "test:mjs": "npm run build && node --experimental-modules ./test/test.mjs",
38
- "debug": "npx tsc --pretty --sourceMap && npx mocha --allow-uncaught --reporter spec --inspect-brk test/index",
39
- "report-coverage": "cat coverage/lcov.info | coveralls",
40
- "example": "npm run build && node ./test/example.js",
41
- "lint": "npx eslint --fix --ignore-path .gitignore ./build",
42
- "lint:test": "npx eslint --fix --ignore-path .gitignore ./test",
43
- "ts:example": "npx tsc ./test-ts/*.ts && npx eslint --fix ./test-ts/*.js && node ./test-ts/test-no-types.js && node ./test-ts/test-with-types.js",
44
- "ts:lint": "npx tslint --fix --ignore-path .gitignore ./src"
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "git+https://github.com/wentout/mnemonica.git"
49
- },
50
- "keywords": [
51
- "ETL",
52
- "DFD",
53
- "inheritance",
54
- "mnemonica"
55
- ],
56
- "author": "went.out@gmail.com",
57
- "license": "MIT",
58
- "bugs": {
59
- "url": "https://github.com/wentout/mnemonica/issues"
60
- },
61
- "lint-staged": {
62
- "*.js": "eslint --fix --ignore-path .gitignore"
63
- },
64
- "homepage": "https://github.com/wentout/mnemonica#readme",
65
- "devDependencies": {
66
- "@types/node": "^13.13.23",
67
- "@typescript-eslint/eslint-plugin": "^2.33.0",
68
- "@typescript-eslint/parser": "^2.33.0",
69
- "chai": "^4.2.0",
70
- "coveralls": "^3.1.0",
71
- "eslint": "^6.8.0",
72
- "eslint-config-prettier": "^6.12.0",
73
- "eslint-plugin-import": "^2.22.1",
74
- "eslint-plugin-mocha": "^5.2.0",
75
- "eslint-plugin-no-arrow-this": "^1.2.0",
76
- "eslint-plugin-prettier": "^3.1.4",
77
- "husky": "^3.0.5",
78
- "lint-staged": "^9.2.5",
79
- "mocha": "^7.2.0",
80
- "mocha-lcov-reporter": "^1.3.0",
81
- "nyc": "^14.1.1",
82
- "tslint": "^6.1.3",
83
- "typescript": "^4.0.3"
84
- },
85
- "engines": {
86
- "node": ">=8.7"
87
- },
88
- "husky": {
89
- "hooks": {
90
- "pre-commit": "lint-staged"
91
- }
92
- },
93
- "dependencies": {}
2
+ "name": "mnemonica",
3
+ "version": "0.9.942",
4
+ "description": "abstract technique that aids information retention : instance inheritance system",
5
+ "type": "commonjs",
6
+ "main": "./build/index.js",
7
+ "exports": {
8
+ ".": "./build/index.js",
9
+ "./module": {
10
+ "import": "./module/index.js",
11
+ "browser": "./module/index.js",
12
+ "require": "./build/index.js",
13
+ "default": "./build/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "README.md",
18
+ "LICENSE",
19
+ "module",
20
+ "build"
21
+ ],
22
+ "directories": {
23
+ "build": "build/",
24
+ "module": "module/"
25
+ },
26
+ "contributors": [
27
+ "laplandin <laplandin.denis@gmail.com>",
28
+ "petrgrishin <iam@petrgrishin.com>",
29
+ "Goodluckhf <Goodluckhf@yandex.ru>"
30
+ ],
31
+ "scripts": {
32
+ "build": "rm -rf ./build && npx tsc --pretty && npm run lint && npm run lint:test",
33
+ "watch": "npx tsc --pretty -w",
34
+ "test": "npm run build && mocha --allow-uncaught test/index.js",
35
+ "test:cov": "npm run build && nyc --reporter=lcov mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
36
+ "test:mjs": "npm run build && node --experimental-modules ./test/test.mjs",
37
+ "debug": "npx tsc --pretty --sourceMap && npx mocha --allow-uncaught --reporter spec --inspect-brk test/index",
38
+ "report-coverage": "cat coverage/lcov.info | coveralls",
39
+ "example": "npm run build && node ./test/example.js",
40
+ "lint": "npx eslint --fix --ignore-path .gitignore ./build",
41
+ "lint:test": "npx eslint --fix --ignore-path .gitignore ./test",
42
+ "ts:example": "npx tsc ./test-ts/*.ts && npx eslint --fix ./test-ts/*.js && node ./test-ts/test-no-types.js && node ./test-ts/test-with-types.js",
43
+ "testjest": "npx jest",
44
+ "testjest:cov": "npx jest --collectCoverage",
45
+ "testjest:debug": "npx --node-arg=--inspect-brk jest"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/wentout/mnemonica.git"
50
+ },
51
+ "keywords": [
52
+ "ETL",
53
+ "DFD",
54
+ "inheritance",
55
+ "mnemonica"
56
+ ],
57
+ "author": "went.out@gmail.com",
58
+ "license": "MIT",
59
+ "bugs": {
60
+ "url": "https://github.com/wentout/mnemonica/issues"
61
+ },
62
+ "lint-staged": {
63
+ "*.js": "eslint --fix --ignore-path .gitignore"
64
+ },
65
+ "homepage": "https://github.com/wentout/mnemonica#readme",
66
+ "devDependencies": {
67
+ "@types/jest": "^27.0.1",
68
+ "@types/node": "^13.13.51",
69
+ "@typescript-eslint/eslint-plugin": "^2.33.0",
70
+ "@typescript-eslint/parser": "^2.33.0",
71
+ "chai": "^4.3.4",
72
+ "coveralls": "^3.1.0",
73
+ "eslint": "^6.8.0",
74
+ "eslint-config-prettier": "^6.12.0",
75
+ "eslint-plugin-import": "^2.22.1",
76
+ "eslint-plugin-mocha": "^5.2.0",
77
+ "eslint-plugin-no-arrow-this": "^1.2.0",
78
+ "eslint-plugin-prettier": "^3.4.0",
79
+ "husky": "^3.0.5",
80
+ "jest": "^27.0.6",
81
+ "lint-staged": "^9.2.5",
82
+ "mocha": "^7.2.0",
83
+ "mocha-lcov-reporter": "^1.3.0",
84
+ "nyc": "^14.1.1",
85
+ "ts-jest": "^27.0.5",
86
+ "tslint": "^6.1.3",
87
+ "typescript": "^4.2.4"
88
+ },
89
+ "engines": {
90
+ "node": ">=8.7"
91
+ },
92
+ "husky": {
93
+ "hooks": {
94
+ "pre-commit": "lint-staged"
95
+ }
96
+ }
94
97
  }