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

@hi-ui/func-utils

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hi-ui/func-utils - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

CHANGELOG.md

43

lib/cjs/index.js

@@ -12,12 +12,5 @@ /** @LICENSE

Object.defineProperty(exports, '__esModule', {
value: true
});
var objectUtils = require('@hi-ui/object-utils');
var typeAssertion = require('@hi-ui/type-assertion');
var noop = function noop() {};
var callAllFuncs = function callAllFuncs() {

@@ -27,3 +20,2 @@ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {

}
return function mergedFunc() {

@@ -33,3 +25,2 @@ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {

}
funcs.forEach(function (func) {

@@ -43,4 +34,2 @@ func && func.apply(void 0, args);

*/
var toArray = function toArray(arg) {

@@ -60,4 +49,2 @@ if (typeAssertion.isNullish(arg)) return [];

*/
var getNested = function getNested(obj, paths) {

@@ -73,3 +60,2 @@ paths = toArray(paths);

var len = props.length;
for (; i < len; ++i) {

@@ -79,6 +65,4 @@ if (typeAssertion.isNullish(target)) {

}
target = target[props[i]];
}
return i === len ? target : undefined;

@@ -95,7 +79,5 @@ };

*/
var setNested = function setNested(obj, paths, value) {
paths = toArray(paths); // just support array
paths = toArray(paths);
// just support array
var props = [];

@@ -107,3 +89,2 @@ paths.forEach(function (p) {

p = p + '';
if (p !== '') {

@@ -117,11 +98,9 @@ props.push(p);

var key;
var objValue; // using clone keep pure
var objValue;
// using clone keep pure
obj = objectUtils.clone(obj);
var target = obj;
while (i < lastIndex) {
key = props[i++];
objValue = target[key];
if (typeAssertion.isObjectLike(objValue)) {

@@ -133,6 +112,4 @@ target[key] = objectUtils.clone(objValue);

}
target = target[key];
}
target[props[i]] = value;

@@ -145,4 +122,2 @@ return obj;

*/
var runIfFunc = function runIfFunc(valueOrFn) {

@@ -152,3 +127,2 @@ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {

}
return typeAssertion.isFunction(valueOrFn) ? valueOrFn.apply(null, args) : valueOrFn;

@@ -162,4 +136,2 @@ };

*/
var debounce = function debounce(func, delay) {

@@ -169,5 +141,3 @@ if (delay === void 0) {

}
var timer = 0;
var cancel = function cancel() {

@@ -179,3 +149,2 @@ if (timer) {

};
var debounceFn = function debounceFn() {

@@ -185,7 +154,5 @@ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {

}
if (timer) {
cancel();
}
if (func) {

@@ -198,7 +165,5 @@ timer = window.setTimeout(function () {

};
debounceFn.cancel = cancel;
return debounceFn;
};
exports.callAllFuncs = callAllFuncs;

@@ -205,0 +170,0 @@ exports.debounce = debounce;

@@ -12,5 +12,3 @@ /** @LICENSE

import { isNullish, isArray, isObjectLike, isFunction } from '@hi-ui/type-assertion';
var noop = function noop() {};
var callAllFuncs = function callAllFuncs() {

@@ -20,3 +18,2 @@ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {

}
return function mergedFunc() {

@@ -26,3 +23,2 @@ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {

}
funcs.forEach(function (func) {

@@ -36,4 +32,2 @@ func && func.apply(void 0, args);

*/
var toArray = function toArray(arg) {

@@ -53,4 +47,2 @@ if (isNullish(arg)) return [];

*/
var getNested = function getNested(obj, paths) {

@@ -66,3 +58,2 @@ paths = toArray(paths);

var len = props.length;
for (; i < len; ++i) {

@@ -72,6 +63,4 @@ if (isNullish(target)) {

}
target = target[props[i]];
}
return i === len ? target : undefined;

@@ -88,7 +77,5 @@ };

*/
var setNested = function setNested(obj, paths, value) {
paths = toArray(paths); // just support array
paths = toArray(paths);
// just support array
var props = [];

@@ -100,3 +87,2 @@ paths.forEach(function (p) {

p = p + '';
if (p !== '') {

@@ -110,11 +96,9 @@ props.push(p);

var key;
var objValue; // using clone keep pure
var objValue;
// using clone keep pure
obj = clone(obj);
var target = obj;
while (i < lastIndex) {
key = props[i++];
objValue = target[key];
if (isObjectLike(objValue)) {

@@ -126,6 +110,4 @@ target[key] = clone(objValue);

}
target = target[key];
}
target[props[i]] = value;

@@ -138,4 +120,2 @@ return obj;

*/
var runIfFunc = function runIfFunc(valueOrFn) {

@@ -145,3 +125,2 @@ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {

}
return isFunction(valueOrFn) ? valueOrFn.apply(null, args) : valueOrFn;

@@ -155,4 +134,2 @@ };

*/
var debounce = function debounce(func, delay) {

@@ -162,5 +139,3 @@ if (delay === void 0) {

}
var timer = 0;
var cancel = function cancel() {

@@ -172,3 +147,2 @@ if (timer) {

};
var debounceFn = function debounceFn() {

@@ -178,7 +152,5 @@ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {

}
if (timer) {
cancel();
}
if (func) {

@@ -191,7 +163,5 @@ timer = window.setTimeout(function () {

};
debounceFn.cancel = cancel;
return debounceFn;
};
export { callAllFuncs, debounce, getNested, noop, runIfFunc, setNested, toArray };
{
"name": "@hi-ui/func-utils",
"version": "4.0.1",
"version": "4.0.2",
"description": "A sub-package for @hi-ui/utils.",

@@ -45,10 +45,7 @@ "keywords": [],

},
"devDependencies": {
"@hi-ui/hi-build": "^4.0.1"
},
"devDependencies": {},
"dependencies": {
"@hi-ui/object-utils": "^4.0.1",
"@hi-ui/type-assertion": "^4.0.1"
},
"gitHead": "cc2be2029ebdd139b4c658071db864827d138f70"
"@hi-ui/object-utils": "^4.0.2",
"@hi-ui/type-assertion": "^4.0.2"
}
}
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