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

@formily/shared

Package Overview
Dependencies
Maintainers
2
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.2.26 to 2.2.27

3

dist/formily.shared.all.d.ts

@@ -34,2 +34,3 @@ declare type EachArrayIterator<T> = (currentValue: T, key: number) => void | boolean;

declare function includes<T>(val: T[], searchElement: T, revert?: boolean): boolean;
declare function move<T extends any>(array: T[], fromIndex: number, toIndex: number): T[];

@@ -239,2 +240,2 @@ declare const isEqual: (a: any, b: any) => any;

export { Path as FormPath, Pattern as FormPathPattern, IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, camelCase, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lazyMerge, lowerCase, map, merge, paramCase, pascalCase, reduce, shallowClone, some, stringLength, toArr, uid, upperCase };
export { Path as FormPath, Pattern as FormPathPattern, IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, camelCase, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lazyMerge, lowerCase, map, merge, move, paramCase, pascalCase, reduce, shallowClone, some, stringLength, toArr, uid, upperCase };

@@ -41,2 +41,3 @@ export { camelCase } from 'camel-case';

declare function includes<T>(val: T[], searchElement: T, revert?: boolean): boolean;
declare function move<T extends any>(array: T[], fromIndex: number, toIndex: number): T[];

@@ -119,2 +120,2 @@ declare const isEqual: (a: any, b: any) => any;

export { IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lazyMerge, map, merge, reduce, shallowClone, some, stringLength, toArr, uid };
export { IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lazyMerge, map, merge, move, reduce, shallowClone, some, stringLength, toArr, uid };

@@ -148,2 +148,27 @@ (function (global, factory) {

}
function move(array, fromIndex, toIndex) {
if (fromIndex === toIndex)
return array;
if (toIndex < 0 ||
fromIndex < 0 ||
toIndex > array.length - 1 ||
fromIndex > array.length - 1) {
return array;
}
if (fromIndex < toIndex) {
var fromItem = array[fromIndex];
for (var index = fromIndex; index < toIndex; index++) {
array[index] = array[index + 1];
}
array[toIndex] = fromItem;
}
else {
var fromItem = array[fromIndex];
for (var index = fromIndex; index > toIndex; index--) {
array[index] = array[index - 1];
}
array[toIndex] = fromItem;
}
return array;
}

@@ -957,2 +982,3 @@ /* istanbul ignore next */

exports.merge = merge;
exports.move = move;
exports.paramCase = paramCase;

@@ -959,0 +985,0 @@ exports.pascalCase = pascalCase;

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

!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("formily.shared",["exports"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).Formily=r.Formily||{},r.Formily.Shared={}))}(this,(function(r){"use strict";!function(){const r={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,r)}catch(r){}globalThis.process={env:r}}();var e=Object.prototype.toString,n=function(r){return function(e){return t(e)==="[object ".concat(r,"]")}},t=function(r){return e.call(r)},i=function(r){return"function"==typeof r},o=Array.isArray,u=n("Object"),c=n("String"),f=n("Boolean"),a=n("Number"),s=function(r){return"object"==typeof r},l=n("RegExp");function p(r,e,n){if(o(r)||c(r)){if(n){for(var t=r.length-1;t>=0;t--)if(!1===e(r[t],t))return}else for(t=0;t<r.length;t++)if(!1===e(r[t],t))return}else if(s(r)){var i=void 0;for(i in r)if(Object.hasOwnProperty.call(r,i)&&!1===e(r[i],i))return}}function b(r,e,n){var t=!1;return p(r,(function(r,n){if(e(r,n))return t=!0,!1}),n),t}var y=function(){try{if("undefined"!=typeof self)return self}catch(r){}try{if("undefined"!=typeof window)return window}catch(r){}try{if("undefined"!=typeof global)return global}catch(r){}return Function("return this")()}(),d=function(r,e){return i(e)?r instanceof e:!!c(e)&&(!!y[e]&&r instanceof y[e])},v=o,g=Object.keys,h=Object.prototype.hasOwnProperty;function O(r,e){if(r===e)return!0;if(r&&e&&"object"==typeof r&&"object"==typeof e){var n,t=v(r),i=v(e),o=void 0,u=void 0;if(t&&i){if((n=r.length)!==e.length)return!1;for(o=n;0!=o--;)if(!O(r[o],e[o]))return!1;return!0}if(t!==i)return!1;var c=r&&r._isAMomentObject,f=e&&e._isAMomentObject;if(c!==f)return!1;if(c&&f)return r.isSame(e);var a=r&&r.toJS;if(a!==(e&&e.toJS))return!1;if(a)return r.is?r.is(e):r===e;var s=d(r,"Date"),l=d(e,"Date");if(s!==l)return!1;if(s&&l)return r.getTime()===e.getTime();var p=d(r,"RegExp"),b=d(e,"RegExp");if(p!==b)return!1;if(p&&b)return r.toString()===e.toString();var y=d(r,"URL"),m=d(e,"URL");if(y!==m)return!1;if(y&&m)return r.href===e.href;var j=r&&r.toJSON,S=e&&e.toJSON;if(j!==S)return!1;if(j&&S)return O(r.toJSON(),e.toJSON());var w=g(r);if((n=w.length)!==g(e).length)return!1;for(o=n;0!=o--;)if(!h.call(e,w[o]))return!1;for(o=n;0!=o--;)if(!("_owner"===(u=w[o])&&r.$$typeof||O(r[u],e[u])))return!1;return!0}return r!=r&&e!=e}var m=function(){return m=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},m.apply(this,arguments)},j=function(r){if(Array.isArray(r)){var e=[];return r.forEach((function(r){e.push(j(r))})),e}if(u(r)){if("$$typeof"in r&&"_owner"in r)return r;if(r._isAMomentObject)return r;if(r._isJSONSchemaObject)return r;if(i(r.toJS))return r.toJS();if(i(r.toJSON))return r.toJSON();var n={};for(var t in r)Object.hasOwnProperty.call(r,t)&&(n[t]=j(r[t]));return n}return r},S=Object.prototype.hasOwnProperty,w=Object.prototype.toString,A=function(r){return null!=r};
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("formily.shared",["exports"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).Formily=r.Formily||{},r.Formily.Shared={}))}(this,(function(r){"use strict";!function(){const r={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,r)}catch(r){}globalThis.process={env:r}}();var e=Object.prototype.toString,n=function(r){return function(e){return t(e)==="[object ".concat(r,"]")}},t=function(r){return e.call(r)},i=function(r){return"function"==typeof r},o=Array.isArray,u=n("Object"),c=n("String"),f=n("Boolean"),a=n("Number"),s=function(r){return"object"==typeof r},l=n("RegExp");function p(r,e,n){if(o(r)||c(r)){if(n){for(var t=r.length-1;t>=0;t--)if(!1===e(r[t],t))return}else for(t=0;t<r.length;t++)if(!1===e(r[t],t))return}else if(s(r)){var i=void 0;for(i in r)if(Object.hasOwnProperty.call(r,i)&&!1===e(r[i],i))return}}function b(r,e,n){var t=!1;return p(r,(function(r,n){if(e(r,n))return t=!0,!1}),n),t}var y=function(){try{if("undefined"!=typeof self)return self}catch(r){}try{if("undefined"!=typeof window)return window}catch(r){}try{if("undefined"!=typeof global)return global}catch(r){}return Function("return this")()}(),v=function(r,e){return i(e)?r instanceof e:!!c(e)&&(!!y[e]&&r instanceof y[e])},d=o,g=Object.keys,h=Object.prototype.hasOwnProperty;function O(r,e){if(r===e)return!0;if(r&&e&&"object"==typeof r&&"object"==typeof e){var n,t=d(r),i=d(e),o=void 0,u=void 0;if(t&&i){if((n=r.length)!==e.length)return!1;for(o=n;0!=o--;)if(!O(r[o],e[o]))return!1;return!0}if(t!==i)return!1;var c=r&&r._isAMomentObject,f=e&&e._isAMomentObject;if(c!==f)return!1;if(c&&f)return r.isSame(e);var a=r&&r.toJS;if(a!==(e&&e.toJS))return!1;if(a)return r.is?r.is(e):r===e;var s=v(r,"Date"),l=v(e,"Date");if(s!==l)return!1;if(s&&l)return r.getTime()===e.getTime();var p=v(r,"RegExp"),b=v(e,"RegExp");if(p!==b)return!1;if(p&&b)return r.toString()===e.toString();var y=v(r,"URL"),m=v(e,"URL");if(y!==m)return!1;if(y&&m)return r.href===e.href;var j=r&&r.toJSON,S=e&&e.toJSON;if(j!==S)return!1;if(j&&S)return O(r.toJSON(),e.toJSON());var w=g(r);if((n=w.length)!==g(e).length)return!1;for(o=n;0!=o--;)if(!h.call(e,w[o]))return!1;for(o=n;0!=o--;)if(!("_owner"===(u=w[o])&&r.$$typeof||O(r[u],e[u])))return!1;return!0}return r!=r&&e!=e}var m=function(){return m=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},m.apply(this,arguments)},j=function(r){if(Array.isArray(r)){var e=[];return r.forEach((function(r){e.push(j(r))})),e}if(u(r)){if("$$typeof"in r&&"_owner"in r)return r;if(r._isAMomentObject)return r;if(r._isJSONSchemaObject)return r;if(i(r.toJS))return r.toJS();if(i(r.toJSON))return r.toJSON();var n={};for(var t in r)Object.hasOwnProperty.call(r,t)&&(n[t]=j(r[t]));return n}return r},S=Object.prototype.hasOwnProperty,w=Object.prototype.toString,A=function(r){return null!=r};
/*! *****************************************************************************

@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function M(r,e){if(void 0===e&&(e=!1),null==r)return!0;if("boolean"==typeof r)return!1;if("number"==typeof r)return!1;if("string"==typeof r)return 0===r.length;if("function"==typeof r)return 0===r.length;if(Array.isArray(r)){if(0===r.length)return!0;for(var n=0;n<r.length;n++)if(e){if(void 0!==r[n]&&null!==r[n])return!1}else if(void 0!==r[n]&&null!==r[n]&&""!==r[n]&&0!==r[n])return!1;return!0}if(d(r,"Error"))return""===r.message;if(r.toString===w)switch(r.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===r.size;case"[object Object]":for(var t in r)if(S.call(r,t))return!1;return!0}return!1}function x(r){return r.toLowerCase()}var E=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],P=/[^A-Z0-9]+/gi;function J(r,e){void 0===e&&(e={});for(var n=e.splitRegexp,t=void 0===n?E:n,i=e.stripRegexp,o=void 0===i?P:i,u=e.transform,c=void 0===u?x:u,f=e.delimiter,a=void 0===f?" ":f,s=_(_(r,t,"$1\0$2"),o,"\0"),l=0,p=s.length;"\0"===s.charAt(l);)l++;for(;"\0"===s.charAt(p-1);)p--;return s.slice(l,p).split("\0").map(c).join(a)}function _(r,e,n){return e instanceof RegExp?r.replace(e,n):e.reduce((function(r,e){return r.replace(e,n)}),r)}function N(r,e){var n=r.charAt(0),t=r.substr(1).toLowerCase();return e>0&&n>="0"&&n<="9"?"_"+n+t:""+n.toUpperCase()+t}function $(r,e){return void 0===e&&(e={}),J(r,m({delimiter:"",transform:N},e))}function R(r,e){return 0===e?r.toLowerCase():N(r,e)}var C="[\ud800-\udbff][\udc00-\udfff]",k=function(r){return"string"==typeof r?r.replace((e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),new RegExp(e,"g")),""):r;var e};const L=Formily.Path.Path;var T={};var F=function(){var r=this;this.subscribers={index:0},this.subscribe=function(e){if(i(e)){var n=r.subscribers.index+1;return r.subscribers[n]=e,r.subscribers.index++,n}},this.unsubscribe=function(e){r.subscribers[e]?delete r.subscribers[e]:e||(r.subscribers={index:0})},this.notify=function(e,n){r.subscription&&r.subscription&&i(r.subscription.notify)&&!1===r.subscription.notify.call(r,e)||n||p(r.subscribers,(function(n){i(n)&&n(function(e){return r.subscription&&i(r.subscription.filter)?r.subscription.filter.call(r,e):e}(e))}))}};function Z(r){return function(r){return Boolean(r)&&"object"==typeof r}(r)&&!function(r){if("$$typeof"in r&&"_owner"in r)return!0;if(r._isAMomentObject)return!0;if(r._isJSONSchemaObject)return!0;if(i(r.toJS))return!0;if(i(r.toJSON))return!0;return!u(r)}(r)}function z(r,e){var n,t;return!1!==e.clone&&(null===(n=e.isMergeableObject)||void 0===n?void 0:n.call(e,r))?I((t=r,Array.isArray(t)?[]:{}),r,e):r}function U(r,e,n){return r.concat(e).map((function(r){return z(r,n)}))}function B(r){return A(r)?Object.keys(r).concat(function(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter((function(e){return r.propertyIsEnumerable(e)})):[]}(r)):[]}function D(r,e){try{return e in r}catch(r){return!1}}function W(r,e,n){var t=n.assign&&r||{};return n.isMergeableObject(r)?(n.assign||B(r).forEach((function(e){t[e]=z(r[e],n)})),B(e).forEach((function(i){(function(r,e){return D(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))})(r,i)||(M(r[i])?t[i]=e[i]:D(r,i)&&n.isMergeableObject(e[i])?t[i]=function(r,e){if(!e.customMerge)return I;var n=e.customMerge(r);return"function"==typeof n?n:I}(i,n)(r[i],e[i],n):t[i]=z(e[i],n))})),t):r}function I(r,e,n){(n=n||{}).arrayMerge=n.arrayMerge||U,n.isMergeableObject=n.isMergeableObject||Z,n.cloneUnlessOtherwiseSpecified=z;var t=Array.isArray(e);return t===Array.isArray(r)?t?n.arrayMerge(r,e,n):W(r,e,n):z(e,n)}for(var q=I,H=function(r){return!((null==(e=r)?void 0:e._owner)&&(null==e?void 0:e.$$typeof)||(null==e?void 0:e._isAMomentObject)||(null==e?void 0:e._isJSONSchemaObject)||(null==e?void 0:e.toJS)||(null==e?void 0:e.toJSON))&&"object"==typeof r;var e},V=function(r,e){if(t(r)===t(e)&&H(r)&&H(e)){var n=o(r)?[]:u(r)?{}:r;return p(e,(function(e,t){n[t]=V(r[t],e)})),p(r,(function(r,e){A(n[e])||(n[e]=r)})),n}return M(e)?r:e},K=36,G="";K--;)G+=K.toString(36);r.FormPath=L,r.Subscribable=F,r.applyMiddleware=function(r,e){void 0===e&&(e=[]);var n=function(r,e){var t=r;return Promise.resolve(e[0](r,(function(r){return n(null!=r?r:t,e.slice(1))})))};return new Promise((function(t,i){n(r,e.concat((function(r){t(r)}))).catch(i)}))},r.camelCase=function(r,e){return void 0===e&&(e={}),$(r,m({transform:R},e))},r.clone=j,r.defaults=V,r.deprecate=function r(e,n,t){if(i(e))return function(i,o,u,c,f){return r(n,t),e.apply(this,arguments)};c(e)&&!T[e]&&(T[e]=!0,console.warn(new Error("".concat(e," has been deprecated. Do not continue to use this api.").concat(n||""))))},r.each=p,r.every=function(r,e,n){var t=!0;return p(r,(function(r,n){if(!e(r,n))return t=!1,!1}),n),t},r.find=function(r,e,n){var t;return p(r,(function(r,n){if(e(r,n))return t=r,!1}),n),t},r.findIndex=function(r,e,n){var t=-1;return p(r,(function(r,n){if(e(r,n))return t=n,!1}),n),t},r.getType=t,r.globalThisPolyfill=y,r.includes=function(r,e,n){return c(r)?r.includes(e):b(r,(function(r){return r===e}),n)},r.instOf=d,r.isArr=o,r.isBool=f,r.isEmpty=M,r.isEqual=function(r,e){try{return O(r,e)}catch(r){if(r.message&&r.message.match(/stack|recursion/i)||-2146828260===r.number)return console.warn("Warning: react-fast-compare does not handle circular references.",r.name,r.message),!1;throw r}},r.isFn=i,r.isHTMLElement=function(r){return Object.prototype.toString.call(r).indexOf("HTML")>-1},r.isMap=function(r){return r&&r instanceof Map},r.isNum=a,r.isNumberLike=function(r){return a(r)||/^\d+$/.test(r)},r.isObj=s,r.isPlainObj=u,r.isReactElement=function(r){return r&&r.$$typeof&&r._owner},r.isRegExp=l,r.isSet=function(r){return r&&r instanceof Set},r.isStr=c,r.isUndef=function(r){return void 0===r},r.isValid=A,r.isWeakMap=function(r){return r&&r instanceof WeakMap},r.isWeakSet=function(r){return r&&r instanceof WeakSet},r.lazyMerge=function(r){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var t=function(r,e){if(!A(e))return r;if(!A(r))return e;var n="function"==typeof r,t="function"==typeof e;if(!("object"==typeof r)&&!n)return e;if(!("object"==typeof e)&&!t)return r;var i=function(){return n?r():r},o=function(){return t?e():e},u=function(r,e){var n=o();return e in n?n[e]:i()[e]};return new Proxy(Object.create(null),{set:function(r,e,n){var t=o(),u=i();return e in t?t[e]=n:e in u?u[e]=n:t[e]=n,!0},get:u,ownKeys:function(){var r=o(),e=i(),n=Object.keys(e);for(var t in r)t in e||n.push(t);return n},getPrototypeOf:function(){return Object.getPrototypeOf({})},getOwnPropertyDescriptor:function(r,e){return{value:u(0,e),enumerable:!0,configurable:!0}},has:function(r,e){return e in o()||e in i()}})};return e.reduce((function(r,e){return t(r,e)}),r)},r.lowerCase=x,r.map=function(r,e,n){var t=o(r)||c(r)?[]:{};return p(r,(function(r,n){var i=e(r,n);o(t)?t.push(i):t[n]=i}),n),t},r.merge=q,r.paramCase=function(r,e){return void 0===e&&(e={}),function(r,e){return void 0===e&&(e={}),J(r,m({delimiter:"."},e))}(r,m({delimiter:"-"},e))},r.pascalCase=$,r.reduce=function(r,e,n,t){var i=n;return p(r,(function(r,n){i=e(i,r,n)}),t),i},r.shallowClone=function(r){return Array.isArray(r)?r.slice(0):u(r)?"$$typeof"in r&&"_owner"in r||r._isAMomentObject||r._isJSONSchemaObject||i(r.toJS)||i(r.toJSON)?r:m({},r):"object"==typeof r?new r.constructor(r):r},r.some=b,r.stringLength=function(r){return k(r).replace(e&&e.exact?new RegExp("^".concat(C,"$")):new RegExp(C,"g")," ").length;var e},r.toArr=function(r){return o(r)?r:r?[r]:[]},r.uid=function(r){for(var e="",n=r||11;n--;)e+=G[36*Math.random()|0];return e},r.upperCase=function(r){return r.toUpperCase()},Object.defineProperty(r,"__esModule",{value:!0})}));
***************************************************************************** */function M(r,e){if(void 0===e&&(e=!1),null==r)return!0;if("boolean"==typeof r)return!1;if("number"==typeof r)return!1;if("string"==typeof r)return 0===r.length;if("function"==typeof r)return 0===r.length;if(Array.isArray(r)){if(0===r.length)return!0;for(var n=0;n<r.length;n++)if(e){if(void 0!==r[n]&&null!==r[n])return!1}else if(void 0!==r[n]&&null!==r[n]&&""!==r[n]&&0!==r[n])return!1;return!0}if(v(r,"Error"))return""===r.message;if(r.toString===w)switch(r.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===r.size;case"[object Object]":for(var t in r)if(S.call(r,t))return!1;return!0}return!1}function x(r){return r.toLowerCase()}var E=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],P=/[^A-Z0-9]+/gi;function J(r,e){void 0===e&&(e={});for(var n=e.splitRegexp,t=void 0===n?E:n,i=e.stripRegexp,o=void 0===i?P:i,u=e.transform,c=void 0===u?x:u,f=e.delimiter,a=void 0===f?" ":f,s=_(_(r,t,"$1\0$2"),o,"\0"),l=0,p=s.length;"\0"===s.charAt(l);)l++;for(;"\0"===s.charAt(p-1);)p--;return s.slice(l,p).split("\0").map(c).join(a)}function _(r,e,n){return e instanceof RegExp?r.replace(e,n):e.reduce((function(r,e){return r.replace(e,n)}),r)}function N(r,e){var n=r.charAt(0),t=r.substr(1).toLowerCase();return e>0&&n>="0"&&n<="9"?"_"+n+t:""+n.toUpperCase()+t}function $(r,e){return void 0===e&&(e={}),J(r,m({delimiter:"",transform:N},e))}function R(r,e){return 0===e?r.toLowerCase():N(r,e)}var C="[\ud800-\udbff][\udc00-\udfff]",k=function(r){return"string"==typeof r?r.replace((e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),new RegExp(e,"g")),""):r;var e};const L=Formily.Path.Path;var T={};var F=function(){var r=this;this.subscribers={index:0},this.subscribe=function(e){if(i(e)){var n=r.subscribers.index+1;return r.subscribers[n]=e,r.subscribers.index++,n}},this.unsubscribe=function(e){r.subscribers[e]?delete r.subscribers[e]:e||(r.subscribers={index:0})},this.notify=function(e,n){r.subscription&&r.subscription&&i(r.subscription.notify)&&!1===r.subscription.notify.call(r,e)||n||p(r.subscribers,(function(n){i(n)&&n(function(e){return r.subscription&&i(r.subscription.filter)?r.subscription.filter.call(r,e):e}(e))}))}};function Z(r){return function(r){return Boolean(r)&&"object"==typeof r}(r)&&!function(r){if("$$typeof"in r&&"_owner"in r)return!0;if(r._isAMomentObject)return!0;if(r._isJSONSchemaObject)return!0;if(i(r.toJS))return!0;if(i(r.toJSON))return!0;return!u(r)}(r)}function z(r,e){var n,t;return!1!==e.clone&&(null===(n=e.isMergeableObject)||void 0===n?void 0:n.call(e,r))?I((t=r,Array.isArray(t)?[]:{}),r,e):r}function U(r,e,n){return r.concat(e).map((function(r){return z(r,n)}))}function B(r){return A(r)?Object.keys(r).concat(function(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter((function(e){return r.propertyIsEnumerable(e)})):[]}(r)):[]}function D(r,e){try{return e in r}catch(r){return!1}}function W(r,e,n){var t=n.assign&&r||{};return n.isMergeableObject(r)?(n.assign||B(r).forEach((function(e){t[e]=z(r[e],n)})),B(e).forEach((function(i){(function(r,e){return D(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))})(r,i)||(M(r[i])?t[i]=e[i]:D(r,i)&&n.isMergeableObject(e[i])?t[i]=function(r,e){if(!e.customMerge)return I;var n=e.customMerge(r);return"function"==typeof n?n:I}(i,n)(r[i],e[i],n):t[i]=z(e[i],n))})),t):r}function I(r,e,n){(n=n||{}).arrayMerge=n.arrayMerge||U,n.isMergeableObject=n.isMergeableObject||Z,n.cloneUnlessOtherwiseSpecified=z;var t=Array.isArray(e);return t===Array.isArray(r)?t?n.arrayMerge(r,e,n):W(r,e,n):z(e,n)}for(var q=I,H=function(r){return!((null==(e=r)?void 0:e._owner)&&(null==e?void 0:e.$$typeof)||(null==e?void 0:e._isAMomentObject)||(null==e?void 0:e._isJSONSchemaObject)||(null==e?void 0:e.toJS)||(null==e?void 0:e.toJSON))&&"object"==typeof r;var e},V=function(r,e){if(t(r)===t(e)&&H(r)&&H(e)){var n=o(r)?[]:u(r)?{}:r;return p(e,(function(e,t){n[t]=V(r[t],e)})),p(r,(function(r,e){A(n[e])||(n[e]=r)})),n}return M(e)?r:e},K=36,G="";K--;)G+=K.toString(36);r.FormPath=L,r.Subscribable=F,r.applyMiddleware=function(r,e){void 0===e&&(e=[]);var n=function(r,e){var t=r;return Promise.resolve(e[0](r,(function(r){return n(null!=r?r:t,e.slice(1))})))};return new Promise((function(t,i){n(r,e.concat((function(r){t(r)}))).catch(i)}))},r.camelCase=function(r,e){return void 0===e&&(e={}),$(r,m({transform:R},e))},r.clone=j,r.defaults=V,r.deprecate=function r(e,n,t){if(i(e))return function(i,o,u,c,f){return r(n,t),e.apply(this,arguments)};c(e)&&!T[e]&&(T[e]=!0,console.warn(new Error("".concat(e," has been deprecated. Do not continue to use this api.").concat(n||""))))},r.each=p,r.every=function(r,e,n){var t=!0;return p(r,(function(r,n){if(!e(r,n))return t=!1,!1}),n),t},r.find=function(r,e,n){var t;return p(r,(function(r,n){if(e(r,n))return t=r,!1}),n),t},r.findIndex=function(r,e,n){var t=-1;return p(r,(function(r,n){if(e(r,n))return t=n,!1}),n),t},r.getType=t,r.globalThisPolyfill=y,r.includes=function(r,e,n){return c(r)?r.includes(e):b(r,(function(r){return r===e}),n)},r.instOf=v,r.isArr=o,r.isBool=f,r.isEmpty=M,r.isEqual=function(r,e){try{return O(r,e)}catch(r){if(r.message&&r.message.match(/stack|recursion/i)||-2146828260===r.number)return console.warn("Warning: react-fast-compare does not handle circular references.",r.name,r.message),!1;throw r}},r.isFn=i,r.isHTMLElement=function(r){return Object.prototype.toString.call(r).indexOf("HTML")>-1},r.isMap=function(r){return r&&r instanceof Map},r.isNum=a,r.isNumberLike=function(r){return a(r)||/^\d+$/.test(r)},r.isObj=s,r.isPlainObj=u,r.isReactElement=function(r){return r&&r.$$typeof&&r._owner},r.isRegExp=l,r.isSet=function(r){return r&&r instanceof Set},r.isStr=c,r.isUndef=function(r){return void 0===r},r.isValid=A,r.isWeakMap=function(r){return r&&r instanceof WeakMap},r.isWeakSet=function(r){return r&&r instanceof WeakSet},r.lazyMerge=function(r){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var t=function(r,e){if(!A(e))return r;if(!A(r))return e;var n="function"==typeof r,t="function"==typeof e;if(!("object"==typeof r)&&!n)return e;if(!("object"==typeof e)&&!t)return r;var i=function(){return n?r():r},o=function(){return t?e():e},u=function(r,e){var n=o();return e in n?n[e]:i()[e]};return new Proxy(Object.create(null),{set:function(r,e,n){var t=o(),u=i();return e in t?t[e]=n:e in u?u[e]=n:t[e]=n,!0},get:u,ownKeys:function(){var r=o(),e=i(),n=Object.keys(e);for(var t in r)t in e||n.push(t);return n},getPrototypeOf:function(){return Object.getPrototypeOf({})},getOwnPropertyDescriptor:function(r,e){return{value:u(0,e),enumerable:!0,configurable:!0}},has:function(r,e){return e in o()||e in i()}})};return e.reduce((function(r,e){return t(r,e)}),r)},r.lowerCase=x,r.map=function(r,e,n){var t=o(r)||c(r)?[]:{};return p(r,(function(r,n){var i=e(r,n);o(t)?t.push(i):t[n]=i}),n),t},r.merge=q,r.move=function(r,e,n){if(e===n)return r;if(n<0||e<0||n>r.length-1||e>r.length-1)return r;if(e<n){for(var t=r[e],i=e;i<n;i++)r[i]=r[i+1];r[n]=t}else{for(t=r[e],i=e;i>n;i--)r[i]=r[i-1];r[n]=t}return r},r.paramCase=function(r,e){return void 0===e&&(e={}),function(r,e){return void 0===e&&(e={}),J(r,m({delimiter:"."},e))}(r,m({delimiter:"-"},e))},r.pascalCase=$,r.reduce=function(r,e,n,t){var i=n;return p(r,(function(r,n){i=e(i,r,n)}),t),i},r.shallowClone=function(r){return Array.isArray(r)?r.slice(0):u(r)?"$$typeof"in r&&"_owner"in r||r._isAMomentObject||r._isJSONSchemaObject||i(r.toJS)||i(r.toJSON)?r:m({},r):"object"==typeof r?new r.constructor(r):r},r.some=b,r.stringLength=function(r){return k(r).replace(e&&e.exact?new RegExp("^".concat(C,"$")):new RegExp(C,"g")," ").length;var e},r.toArr=function(r){return o(r)?r:r?[r]:[]},r.uid=function(r){for(var e="",n=r||11;n--;)e+=G[36*Math.random()|0];return e},r.upperCase=function(r){return r.toUpperCase()},Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=formily.shared.umd.production.js.map

@@ -34,2 +34,3 @@ declare type EachArrayIterator<T> = (currentValue: T, key: number) => void | boolean;

export declare function includes<T>(val: T[], searchElement: T, revert?: boolean): boolean;
export declare function move<T extends any>(array: T[], fromIndex: number, toIndex: number): T[];
export {};

@@ -97,2 +97,27 @@ import { isArr, isObj, isStr } from './checkers';

}
export function move(array, fromIndex, toIndex) {
if (fromIndex === toIndex)
return array;
if (toIndex < 0 ||
fromIndex < 0 ||
toIndex > array.length - 1 ||
fromIndex > array.length - 1) {
return array;
}
if (fromIndex < toIndex) {
var fromItem = array[fromIndex];
for (var index = fromIndex; index < toIndex; index++) {
array[index] = array[index + 1];
}
array[toIndex] = fromItem;
}
else {
var fromItem = array[fromIndex];
for (var index = fromIndex; index > toIndex; index--) {
array[index] = array[index - 1];
}
array[toIndex] = fromItem;
}
return array;
}
//# sourceMappingURL=array.js.map

@@ -34,2 +34,3 @@ declare type EachArrayIterator<T> = (currentValue: T, key: number) => void | boolean;

export declare function includes<T>(val: T[], searchElement: T, revert?: boolean): boolean;
export declare function move<T extends any>(array: T[], fromIndex: number, toIndex: number): T[];
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.includes = exports.find = exports.findIndex = exports.some = exports.every = exports.reduce = exports.map = exports.each = exports.toArr = void 0;
exports.move = exports.includes = exports.find = exports.findIndex = exports.some = exports.every = exports.reduce = exports.map = exports.each = exports.toArr = void 0;
var checkers_1 = require("./checkers");

@@ -109,2 +109,28 @@ var toArr = function (val) { return ((0, checkers_1.isArr)(val) ? val : val ? [val] : []); };

exports.includes = includes;
function move(array, fromIndex, toIndex) {
if (fromIndex === toIndex)
return array;
if (toIndex < 0 ||
fromIndex < 0 ||
toIndex > array.length - 1 ||
fromIndex > array.length - 1) {
return array;
}
if (fromIndex < toIndex) {
var fromItem = array[fromIndex];
for (var index = fromIndex; index < toIndex; index++) {
array[index] = array[index + 1];
}
array[toIndex] = fromItem;
}
else {
var fromItem = array[fromIndex];
for (var index = fromIndex; index > toIndex; index--) {
array[index] = array[index - 1];
}
array[toIndex] = fromItem;
}
return array;
}
exports.move = move;
//# sourceMappingURL=array.js.map
{
"name": "@formily/shared",
"version": "2.2.26",
"version": "2.2.27",
"license": "MIT",

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

},
"gitHead": "7b74842c4c74bf3fea318c1e0f889c809b0954b9",
"gitHead": "3627fb1c63c0018ee19cb27ba4d28ae3d42abb89",
"scripts": {

@@ -35,3 +35,3 @@ "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && npm run build:umd",

"dependencies": {
"@formily/path": "2.2.26",
"@formily/path": "2.2.27",
"camel-case": "^4.1.1",

@@ -38,0 +38,0 @@ "lower-case": "^2.0.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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