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

@formily/shared

Package Overview
Dependencies
Maintainers
1
Versions
243
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formily/shared - npm Package Compare versions

Comparing version 2.0.0-beta.0 to 2.0.0-beta.1

2

lib/defaults.d.ts

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

export declare const defaults: (...args: any[]) => any;
export declare const defaults: (defaults_: any, targets: any) => any;

@@ -5,16 +5,42 @@ "use strict";

var isEmpty_1 = require("./isEmpty");
exports.defaults = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
var types_1 = require("./types");
var big_data_1 = require("./big-data");
var isUnNormalObject = function (value) {
if ((value === null || value === void 0 ? void 0 : value._owner) || (value === null || value === void 0 ? void 0 : value.$$typeof)) {
return true;
}
var result = {};
array_1.each(args, function (target) {
array_1.each(target, function (value, key) {
if (isEmpty_1.isValid(value)) {
result[key] = value;
if ((value === null || value === void 0 ? void 0 : value._isAMomentObject) || (value === null || value === void 0 ? void 0 : value._isJSONSchemaObject)) {
return true;
}
if ((value === null || value === void 0 ? void 0 : value.toJS) || (value === null || value === void 0 ? void 0 : value.toJSON)) {
return true;
}
};
var isPlainValue = function (val) {
if (isUnNormalObject(val)) {
return false;
}
if (big_data_1.BigData.isBigData(val)) {
return false;
}
return types_1.isPlainObj(val) || types_1.isArr(val);
};
exports.defaults = function (defaults_, targets) {
if (types_1.getType(defaults_) !== types_1.getType(targets) ||
!isPlainValue(defaults_) ||
!isPlainValue(targets)) {
return isEmpty_1.isValid(targets) ? targets : defaults_;
}
else {
var results_1 = types_1.isPlainObj(defaults_) ? {} : [];
array_1.each(targets, function (value, key) {
results_1[key] = exports.defaults(defaults_[key], value);
});
array_1.each(defaults_, function (value, key) {
if (!isEmpty_1.isValid(results_1[key])) {
results_1[key] = value;
}
});
});
return result;
return results_1;
}
};

@@ -10,3 +10,3 @@ import { Subscriber, Subscription } from './types';

unsubscribe: (index: number) => void;
notify: (payload?: Payload) => void;
notify: (payload?: Payload, silent?: boolean) => void;
}

@@ -24,3 +24,3 @@ "use strict";

};
this.notify = function (payload) {
this.notify = function (payload, silent) {
if (_this.subscription) {

@@ -33,2 +33,4 @@ if (_this.subscription && types_1.isFn(_this.subscription.notify)) {

}
if (silent)
return;
var filter = function (payload) {

@@ -35,0 +37,0 @@ if (_this.subscription && types_1.isFn(_this.subscription.filter)) {

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

export declare const getType: (obj: any) => any;
export declare const isFn: (obj: unknown) => obj is (...args: any[]) => any;

@@ -2,0 +3,0 @@ export declare const isArr: (arg: any) => arg is any[];

@@ -5,4 +5,5 @@ "use strict";

return obj != null &&
(Array.isArray(type) ? type : [type]).some(function (t) { return Object.prototype.toString.call(obj) === "[object " + t + "]"; });
(Array.isArray(type) ? type : [type]).some(function (t) { return exports.getType(obj) === "[object " + t + "]"; });
}; };
exports.getType = function (obj) { return Object.prototype.toString.call(obj); };
exports.isFn = isType([

@@ -9,0 +10,0 @@ 'Function',

{
"name": "@formily/shared",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"license": "MIT",

@@ -21,3 +21,3 @@ "main": "lib",

},
"gitHead": "edf8f5b38d7c128501d01151729a85a7ca9ef132",
"gitHead": "6df5f26eb83039bbdfc686bb6268b699aa4e6d04",
"scripts": {

@@ -24,0 +24,0 @@ "build": "tsc --declaration"

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