@fower/utils
Advanced tools
Comparing version 1.62.0 to 1.62.1
@@ -36,2 +36,2 @@ import hash from 'string-hash'; | ||
*/ | ||
export declare function argsToProps(args: any[]): any; | ||
export declare function argsToProps(args: any[], objectPropKey?: string): any; |
@@ -27,17 +27,2 @@ 'use strict'; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
@@ -81,4 +66,2 @@ if (!o) return; | ||
var _excluded = ["css"]; | ||
var _document$head; | ||
@@ -160,3 +143,9 @@ var isBrowser = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9 && !!((_document$head = document.head) != null && _document$head.append); | ||
function argsToProps(args) { | ||
function argsToProps(args, objectPropKey) { | ||
var _args$reduce, _extends2; | ||
if (objectPropKey === void 0) { | ||
objectPropKey = 'css'; | ||
} | ||
var obj = args.reduce(function (result, cur) { | ||
@@ -175,16 +164,8 @@ if (typeof cur === 'string') { | ||
} else { | ||
result.css = _extends({}, result.css, cur); | ||
result[objectPropKey] = _extends({}, result[objectPropKey], cur); | ||
} | ||
return result; | ||
}, { | ||
css: {} | ||
}); | ||
var css = obj.css, | ||
rest = _objectWithoutPropertiesLoose(obj, _excluded); | ||
return _extends({}, rest, { | ||
css: css | ||
}); // make css to lasted attr | ||
}, (_args$reduce = {}, _args$reduce[objectPropKey] = {}, _args$reduce)); | ||
return _extends({}, obj, (_extends2 = {}, _extends2[objectPropKey] = obj[objectPropKey], _extends2)); // make css to lasted attr | ||
} | ||
@@ -191,0 +172,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=(e=require("string-hash"))&&"object"==typeof e&&"default"in e?e.default:e;function t(){return(t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function n(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var o,s=["css"],u="object"==typeof window&&"object"==typeof document&&9===document.nodeType&&!(null==(o=document.head)||!o.append);function i(e){return void 0===e&&(e=""),e.replace(/^[A-Z]/,(function(e){return e.toLowerCase()}))}function a(e){return i(e).replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})).replace(/-+/g,"-")}exports.hash=r,exports.argsToProps=function(e){var r=e.reduce((function(e,r){if("string"==typeof r&&"className"!==r&&(e[r]=!0),"object"!=typeof r)return e;if(Array.isArray(r))for(var o,s=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return n(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,void 0):void 0}}(e))){t&&(e=t);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r);!(o=s()).done;)e[o.value]=!0;else e.css=t({},e.css,r);return e}),{css:{}}),o=r.css;return t({},function(e,r){if(null==e)return{};var t,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r.indexOf(t=s[n])>=0||(o[t]=e[t]);return o}(r,s),{css:o})},exports.camel=function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(function(e,r){return 0===r?e.toLowerCase():e.toUpperCase()})).replace(/(\s+|-|_)/g,"")},exports.downFirst=i,exports.isBrowser=u,exports.isEmptyObj=function(e){return!e||!Object.keys(e).length},exports.isNumber=function(e){return/^-?[0-9.]+$/.test(e)},exports.isPercentNumber=function(e){return/^-?\d+p$/.test(e)},exports.jsKeyToCssKey=function(e){return/^[A-Z].+$/.test(e)?"-"+a(e):a(e)},exports.kebab=a,exports.objectToClassName=function(e,t){return void 0===t&&(t="css-"),t+r(JSON.stringify(e))},exports.upFirst=function(e){return void 0===e&&(e=""),e.replace(/^[a-z]/,(function(e){return e.toUpperCase()}))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=(e=require("string-hash"))&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var a="object"==typeof window&&"object"==typeof document&&9===document.nodeType&&!(null==(r=document.head)||!r.append);function i(e){return void 0===e&&(e=""),e.replace(/^[A-Z]/,(function(e){return e.toLowerCase()}))}function s(e){return i(e).replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})).replace(/-+/g,"-")}exports.hash=t,exports.argsToProps=function(e,r){var t,a;void 0===r&&(r="css");var i=e.reduce((function(e,t){if("string"==typeof t&&"className"!==t&&(e[t]=!0),"object"!=typeof t)return e;if(Array.isArray(t))for(var a,i=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return o(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,void 0):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(a=i()).done;)e[a.value]=!0;else e[r]=n({},e[r],t);return e}),((t={})[r]={},t));return n({},i,((a={})[r]=i[r],a))},exports.camel=function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(function(e,r){return 0===r?e.toLowerCase():e.toUpperCase()})).replace(/(\s+|-|_)/g,"")},exports.downFirst=i,exports.isBrowser=a,exports.isEmptyObj=function(e){return!e||!Object.keys(e).length},exports.isNumber=function(e){return/^-?[0-9.]+$/.test(e)},exports.isPercentNumber=function(e){return/^-?\d+p$/.test(e)},exports.jsKeyToCssKey=function(e){return/^[A-Z].+$/.test(e)?"-"+s(e):s(e)},exports.kebab=s,exports.objectToClassName=function(e,r){return void 0===r&&(r="css-"),r+t(JSON.stringify(e))},exports.upFirst=function(e){return void 0===e&&(e=""),e.replace(/^[a-z]/,(function(e){return e.toUpperCase()}))}; | ||
//# sourceMappingURL=utils.cjs.production.min.js.map |
@@ -22,17 +22,2 @@ import hash from 'string-hash'; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
@@ -76,4 +61,2 @@ if (!o) return; | ||
var _excluded = ["css"]; | ||
var _document$head; | ||
@@ -155,3 +138,9 @@ var isBrowser = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9 && !!((_document$head = document.head) != null && _document$head.append); | ||
function argsToProps(args) { | ||
function argsToProps(args, objectPropKey) { | ||
var _args$reduce, _extends2; | ||
if (objectPropKey === void 0) { | ||
objectPropKey = 'css'; | ||
} | ||
var obj = args.reduce(function (result, cur) { | ||
@@ -170,16 +159,8 @@ if (typeof cur === 'string') { | ||
} else { | ||
result.css = _extends({}, result.css, cur); | ||
result[objectPropKey] = _extends({}, result[objectPropKey], cur); | ||
} | ||
return result; | ||
}, { | ||
css: {} | ||
}); | ||
var css = obj.css, | ||
rest = _objectWithoutPropertiesLoose(obj, _excluded); | ||
return _extends({}, rest, { | ||
css: css | ||
}); // make css to lasted attr | ||
}, (_args$reduce = {}, _args$reduce[objectPropKey] = {}, _args$reduce)); | ||
return _extends({}, obj, (_extends2 = {}, _extends2[objectPropKey] = obj[objectPropKey], _extends2)); // make css to lasted attr | ||
} | ||
@@ -186,0 +167,0 @@ |
{ | ||
"name": "@fower/utils", | ||
"version": "1.62.0", | ||
"version": "1.62.1", | ||
"license": "MIT", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "c78651bac4d0f47c72961471dd97a4024dde098a" | ||
"gitHead": "947f741a52a2f1c3eb3944fb7f520fcccaac6ec1" | ||
} |
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
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
28423
346