Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datx-utils

Package Overview
Dependencies
Maintainers
9
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datx-utils - npm Package Compare versions

Comparing version 0.16.0-2 to 0.16.0

LICENSE

23

dist/helpers.d.ts

@@ -18,16 +18,7 @@ /**

* @template T
* @param {Array<Array<T>>} data Arrays to flatten
* @param {Array<Array<T>|T>} data Arrays to flatten
* @returns {Array<T>} Flattened array
*/
export declare function flatten<T>(data: Array<Array<T>>): Array<T>;
export declare function flatten<T>(data: Array<Array<T> | T>): Array<T>;
/**
* Return a unique set of items in an array
*
* @export
* @template T
* @param {Array<T>} data Array to filter
* @returns {Array<T>} Filtered array
*/
export declare function uniq<T>(data: Array<T>): Array<T>;
/**
* Check if the given variable is an array with at least one falsy value

@@ -49,6 +40,6 @@ *

*/
export declare function assignComputed<T = any>(obj: object, key: string, getter: () => T, setter?: (value: T) => void): void;
export declare function error(...args: any[]): void;
export declare function warn(...args: any[]): void;
export declare function deprecated(...args: any[]): void;
export declare function info(...args: any[]): void;
export declare function assignComputed<T = any>(obj: object, key: string, getter?: () => T, setter?: (value: T) => void): void;
export declare function error(...args: Array<any>): void;
export declare function warn(...args: Array<any>): void;
export declare function deprecated(...args: Array<any>): void;
export declare function info(...args: Array<any>): void;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mobx=require("mobx"),DEFAULT_TYPE="__DEFAULT_TYPE__",META_FIELD="__META__";function mapItems(e,r){return e instanceof Array?e.map(function(e){return r(e)}):null===e?null:r(e)}function flatten(e){var r;return(r=[]).concat.apply(r,e)}function uniq(e){return Array.from(new Set(e))}function isFalsyArray(e){return e instanceof Array&&!e.every(Boolean)}function assignComputed(e,r,n,o){var t,a,s;r in e&&(s=e[r],delete e[r]),o?mobx.extendObservable(e,(t={},Object.defineProperty(t,r,{get:function(){return n()},enumerable:!0,configurable:!0}),Object.defineProperty(t,r,{set:function(e){o&&o(e)},enumerable:!0,configurable:!0}),t)):mobx.extendObservable(e,(a={},Object.defineProperty(a,r,{get:function(){return n()},enumerable:!0,configurable:!0}),a)),void 0!==s&&(e[r]=s)}function error(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];console.error.apply(console,["[datx error]"].concat(e))}function warn(){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,["[datx warning]"].concat(e))}function deprecated(){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,["[datx deprecated]"].concat(e))}function info(){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,["[datx info]"].concat(e))}exports.DEFAULT_TYPE=DEFAULT_TYPE,exports.META_FIELD=META_FIELD,exports.assignComputed=assignComputed,exports.mapItems=mapItems,exports.flatten=flatten,exports.uniq=uniq,exports.isFalsyArray=isFalsyArray,exports.error=error,exports.warn=warn,exports.deprecated=deprecated,exports.info=info;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mobx=require("mobx"),DEFAULT_TYPE="__DEFAULT_TYPE__",META_FIELD="__META__";function mapItems(e,r){return e instanceof Array?e.map(function(e){return r(e)}):null===e?null:r(e)}function flatten(e){var r;return(r=[]).concat.apply(r,e)}function isFalsyArray(e){return e instanceof Array&&!e.every(Boolean)}function undefinedGetter(){}function defaultSetter(){throw new Error("The setter is not defined for this property")}function assignComputed(r,t,e,n){var o;void 0===e&&(e=undefinedGetter),void 0===n&&(n=defaultSetter);var a=Symbol.for("datx administration");r.hasOwnProperty(a)||Object.defineProperty(r,a,{configurable:!1,enumerable:!1,value:{}}),r[a]["get__"+t]=e,r[a]["set__"+t]=n,r.hasOwnProperty(t)||mobx.extendObservable(r,(o={},Object.defineProperty(o,t,{get:function(){return r[a]["get__"+t]()},enumerable:!0,configurable:!0}),Object.defineProperty(o,t,{set:function(e){n&&r[a]["set__"+t](e)},enumerable:!0,configurable:!0}),o))}function error(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];console.error.apply(console,["[datx error]"].concat(e))}function warn(){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,["[datx warning]"].concat(e))}function deprecated(){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,["[datx deprecated]"].concat(e))}function info(){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,["[datx info]"].concat(e))}exports.DEFAULT_TYPE=DEFAULT_TYPE,exports.META_FIELD=META_FIELD,exports.assignComputed=assignComputed,exports.deprecated=deprecated,exports.error=error,exports.flatten=flatten,exports.info=info,exports.isFalsyArray=isFalsyArray,exports.mapItems=mapItems,exports.warn=warn;
export { DEFAULT_TYPE, META_FIELD } from './consts';
export { IDictionary } from './interfaces/IDictionary';
export { IRawModel } from './interfaces/IRawModel';
export { assignComputed, mapItems, flatten, uniq, isFalsyArray, error, warn, deprecated, info, } from './helpers';
export { assignComputed, mapItems, flatten, isFalsyArray, error, warn, deprecated, info, } from './helpers';

@@ -18,3 +18,3 @@ import { extendObservable } from 'mobx';

* @template T
* @param {Array<Array<T>>} data Arrays to flatten
* @param {Array<Array<T>|T>} data Arrays to flatten
* @returns {Array<T>} Flattened array

@@ -27,13 +27,2 @@ */

/**
* Return a unique set of items in an array
*
* @export
* @template T
* @param {Array<T>} data Array to filter
* @returns {Array<T>} Filtered array
*/
function uniq(data) {
return Array.from(new Set(data));
}
/**
* Check if the given variable is an array with at least one falsy value

@@ -48,2 +37,8 @@ *

}
function undefinedGetter() {
return undefined;
}
function defaultSetter() {
throw new Error('The setter is not defined for this property');
}
/**

@@ -59,13 +54,20 @@ * Add a computed property to an observable object

function assignComputed(obj, key, getter, setter) {
var _a, _b;
var value;
if (key in obj) {
value = obj[key];
delete obj[key];
var _a;
if (getter === void 0) { getter = undefinedGetter; }
if (setter === void 0) { setter = defaultSetter; }
var admin = Symbol.for('datx administration');
if (!obj.hasOwnProperty(admin)) {
Object.defineProperty(obj, admin, {
configurable: false,
enumerable: false,
value: {},
});
}
if (setter) {
obj[admin]["get__" + key] = getter;
obj[admin]["set__" + key] = setter;
if (!obj.hasOwnProperty(key)) {
extendObservable(obj, (_a = {},
Object.defineProperty(_a, key, {
get: function () {
return getter();
return obj[admin]["get__" + key]();
},

@@ -78,3 +80,3 @@ enumerable: true,

if (setter) {
setter(val);
obj[admin]["set__" + key](val);
}

@@ -87,16 +89,2 @@ },

}
else {
extendObservable(obj, (_b = {},
Object.defineProperty(_b, key, {
get: function () {
return getter();
},
enumerable: true,
configurable: true
}),
_b));
}
if (value !== undefined) {
obj[key] = value;
}
}

@@ -145,2 +133,2 @@ function error() {

export { DEFAULT_TYPE, META_FIELD, assignComputed, mapItems, flatten, uniq, isFalsyArray, error, warn, deprecated, info };
export { DEFAULT_TYPE, META_FIELD, assignComputed, deprecated, error, flatten, info, isFalsyArray, mapItems, warn };
{
"name": "datx-utils",
"version": "0.16.0-2",
"version": "0.16.0",
"description": "DatX lib utils for mixins",

@@ -24,13 +24,13 @@ "main": "dist/index.cjs.js",

"devDependencies": {
"@infinumjs/tslint-config": "^2.0.0-beta.5",
"@types/jest": "^23.3.2",
"@types/node": "^10.11.3",
"jest": "^23.6.0",
"mobx": "^5.5.0",
"rollup": "^0.68.0",
"rollup-plugin-typescript2": "^0.18.0",
"rollup-plugin-uglify": "^6.0.0",
"ts-jest": "^23.10.2",
"tslint": "^5.11.0",
"typescript": "^3.1.1"
"@infinumjs/tslint-config": "^2.0.0-beta.6",
"@types/jest": "^24.0.11",
"@types/node": "^11.13.4",
"jest": "^24.7.1",
"mobx": "^5.9.4",
"rollup": "^1.10.0",
"rollup-plugin-typescript2": "^0.20.1",
"rollup-plugin-uglify": "^6.0.2",
"ts-jest": "^24.0.2",
"tslint": "^5.15.0",
"typescript": "^3.4.3"
},

@@ -66,3 +66,4 @@ "peerDependencies": {

"testMatch": null
}
},
"gitHead": "37651ced2262117f6005a6f80fd4abaea3ce2859"
}

@@ -21,4 +21,4 @@ # datx-utils

datx-utils is maintained and sponsored by
[Infinum](http://www.infinum.co).
[Infinum](https://www.infinum.co).
<img src="https://infinum.co/infinum.png" width="264">
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc