datx-utils
Advanced tools
Comparing version 2.0.0-beta.6 to 2.0.0-beta.7
@@ -0,1 +1,3 @@ | ||
export declare const makeObservable: any; | ||
export declare function isArrayLike(value: any): boolean; | ||
export declare function reducePrototypeChain<T, U>(obj: U, reduceFn: (state: T, item: U) => T, initialValue: T): T; | ||
@@ -2,0 +4,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("mobx"),r=Symbol.for("datx administration");function t(){for(var e=0,r=0,t=arguments.length;r<t;r++)e+=arguments[r].length;var o=Array(e),n=0;for(r=0;r<t;r++)for(var s=arguments[r],a=0,c=s.length;a<c;a++,n++)o[n]=s[a];return o}function o(){}function n(){throw new Error("The setter is not defined for this property")}function s(t){return Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!1,value:e.observable({},{},{deep:!1})}),t[r]}exports.DEFAULT_TYPE="__DEFAULT_TYPE__",exports.META_FIELD="__META__",exports.assignComputed=function(r,t,s,a){void 0===s&&(s=o),void 0===a&&(a=n);var c=e.extendObservable({},{get getter(){return s.call(r)}});Object.defineProperty(r,t,{get:function(){return c.getter},set:function(e){a.call(r,e)},enumerable:!0,configurable:!0})},exports.deprecated=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.warn.apply(console,t(["[datx deprecated]"],e))},exports.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];console.error.apply(console,t(["[datx error]"],e))},exports.getMeta=function e(r,t,o,n,a){if(n)return function(e,r,t){for(var o=t,n=e;n;)o=r(o,n),n=Object.getPrototypeOf(n);return o}(r,(function(r,o){var n=e(o,t,a?{}:void 0);return a?Object.assign({},n,r):r||n}),a?{}:void 0)||o;var c=s(r);return void 0===c[t]?o:c[t]},exports.getMetaObj=s,exports.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.info.apply(console,t(["[datx info]"],e))},exports.mapItems=function(r,t){return e.isArrayLike(r)?r.map((function(e){return t(e)})):null===r?null:t(r)},exports.mergeMeta=function(e,r){var t=s(e);return Object.assign(t,r),t},exports.setMeta=function(r,t,o){var n=s(r);e.set(n,t,o)},exports.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.warn.apply(console,t(["[datx warning]"],e))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("mobx"),t=Symbol.for("datx administration");function o(){for(var e=0,r=0,t=arguments.length;r<t;r++)e+=arguments[r].length;var o=Array(e),n=0;for(r=0;r<t;r++)for(var a=arguments[r],s=0,c=a.length;s<c;s++,n++)o[n]=a[s];return o}try{e=require("mobx").makeObservable}catch(e){}var n=e||function(e,r){};function a(e){return Array.isArray(e)||r.isObservableArray(e)}function s(){}function c(){throw new Error("The setter is not defined for this property")}function i(e){return Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!1,value:r.observable({},{},{deep:!1})}),e[t]}exports.DEFAULT_TYPE="__DEFAULT_TYPE__",exports.META_FIELD="__META__",exports.assignComputed=function(e,t,o,n){void 0===o&&(o=s),void 0===n&&(n=c);var a=r.extendObservable({},{get getter(){return o.call(e)}});Object.defineProperty(e,t,{get:function(){return a.getter},set:function(r){n.call(e,r)},enumerable:!0,configurable:!0})},exports.deprecated=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.warn.apply(console,o(["[datx deprecated]"],e))},exports.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];console.error.apply(console,o(["[datx error]"],e))},exports.getMeta=function e(r,t,o,n,a){if(n)return function(e,r,t){for(var o=t,n=e;n;)o=r(o,n),n=Object.getPrototypeOf(n);return o}(r,(function(r,o){var n=e(o,t,a?{}:void 0);return a?Object.assign({},n,r):r||n}),a?{}:void 0)||o;var s=i(r);return void 0===s[t]?o:s[t]},exports.getMetaObj=i,exports.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.info.apply(console,o(["[datx info]"],e))},exports.isArrayLike=a,exports.makeObservable=n,exports.mapItems=function(e,r){return a(e)?e.map((function(e){return r(e)})):null===e?null:r(e)},exports.mergeMeta=function(e,r){var t=i(e);return Object.assign(t,r),t},exports.setMeta=function(e,t,o){var n=i(e);r.set(n,t,o)},exports.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.warn.apply(console,o(["[datx warning]"],e))}; |
export { DEFAULT_TYPE, META_FIELD } from './consts'; | ||
export { IRawModel } from './interfaces/IRawModel'; | ||
export { assignComputed, mapItems, error, warn, deprecated, info, getMeta, setMeta, mergeMeta, getMetaObj, } from './helpers'; | ||
export { assignComputed, mapItems, error, warn, deprecated, info, getMeta, setMeta, mergeMeta, getMetaObj, isArrayLike, makeObservable, } from './helpers'; |
@@ -1,2 +0,2 @@ | ||
import { isArrayLike, observable, set, extendObservable } from 'mobx'; | ||
import { isObservableArray, observable, set, extendObservable } from 'mobx'; | ||
@@ -30,2 +30,17 @@ var DEFAULT_TYPE = '__DEFAULT_TYPE__'; | ||
var makeObservableFn; | ||
try { | ||
makeObservableFn = require('mobx').makeObservable; | ||
} | ||
catch (_a) { | ||
// mobx 4/5 | ||
} | ||
var makeObservable = makeObservableFn || | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
(function (target, annotations) { | ||
// noop by default | ||
}); | ||
function isArrayLike(value) { | ||
return Array.isArray(value) || isObservableArray(value); | ||
} | ||
function reducePrototypeChain(obj, reduceFn, initialValue) { | ||
@@ -155,2 +170,2 @@ var value = initialValue; | ||
export { DEFAULT_TYPE, META_FIELD, assignComputed, deprecated, error, getMeta, getMetaObj, info, mapItems, mergeMeta, setMeta, warn }; | ||
export { DEFAULT_TYPE, META_FIELD, assignComputed, deprecated, error, getMeta, getMetaObj, info, isArrayLike, makeObservable, mapItems, mergeMeta, setMeta, warn }; |
{ | ||
"name": "datx-utils", | ||
"version": "2.0.0-beta.6", | ||
"version": "2.0.0-beta.7", | ||
"description": "DatX lib utils for mixins", | ||
@@ -24,17 +24,17 @@ "main": "dist/index.cjs.js", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^13.0.0", | ||
"@rollup/plugin-node-resolve": "^8.1.0", | ||
"@types/jest": "^26.0.3", | ||
"@types/node": "^14.0.14", | ||
"jest": "^26.1.0", | ||
"mobx": "^5.15.4", | ||
"rollup": "^2.18.1", | ||
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.10", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"ts-jest": "^26.1.1", | ||
"typescript": "^3.9.5" | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@types/jest": "^26.0.14", | ||
"@types/node": "^14.11.2", | ||
"jest": "^26.4.2", | ||
"mobx": "^6.0.0", | ||
"rollup": "^2.28.2", | ||
"rollup-plugin-exclude-dependencies-from-bundle": "^1.1.13", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.27.3", | ||
"ts-jest": "^26.4.1", | ||
"typescript": "^4.0.3" | ||
}, | ||
"peerDependencies": { | ||
"mobx": "^4.2.0 || ^5.5.0" | ||
"mobx": "^4.2.0 || ^5.5.0 || ^6.0.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12421
217