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

@hsds/utils-react

Package Overview
Dependencies
Maintainers
6
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hsds/utils-react - npm Package Compare versions

Comparing version 5.2.1 to 7.0.0

index.cjs

24

CHANGELOG.md

@@ -5,4 +5,26 @@ # Changelog

### [5.2.1](https://github.com/helpscout/hsds/compare/utils-react-5.2.0...utils-react-5.2.1) (2022-08-25)
# [7.0.0](https://github.com/helpscout/hsds/compare/v6.0.0...v7.0.0) (2023-01-12)
# [6.0.0](https://github.com/helpscout/hsds/compare/v5.0.0...v6.0.0) (2023-01-12)
# [5.0.0](https://github.com/helpscout/hsds/compare/v4.0.0...v5.0.0) (2023-01-12)
### Bug Fixes
* **workspace:** remove esm module from projects ([829cc37](https://github.com/helpscout/hsds/commit/829cc3795f54a8bcfbc0c45b5bc36bd17463bf54))
### Features
* **workspace:** improves versioning packages ([b836826](https://github.com/helpscout/hsds/commit/b836826d549aeb7295498f1091c783136079f134))
### [5.2.1](https://github.com/helpscout/hsds/compare/utils-react-5.2.0...utils-react-5.2.1) (2022-08-29)
## [5.2.0](https://github.com/helpscout/hsds/compare/utils-react-5.1.0...utils-react-5.2.0) (2022-08-18)

@@ -9,0 +31,0 @@

12

package.json
{
"name": "@hsds/utils-react",
"version": "5.2.1",
"version": "7.0.0",
"peerDependencies": {
"react": "~16.14.0 || ~17.0.2"
},
"main": "./index.cjs.js",
"module": "./index.esm.js",
"typings": "./index.d.ts",
"main": "./index.cjs",
"type": "commonjs",
"types": "./index.d.ts",
"dependencies": {
"lodash.get": "^4.4.2",
"lodash.isplainobject": "^4.0.6"
"lodash.get": "4.4.2",
"lodash.isplainobject": "4.0.6"
}
}

@@ -12,17 +12,12 @@ "use strict";

exports.wrapComponentName = wrapComponentName;
var _react = _interopRequireDefault(require("react"));
var _lodash = _interopRequireDefault(require("lodash.get"));
var _lodash2 = _interopRequireDefault(require("lodash.isplainobject"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable no-misleading-character-class */
/* eslint-disable no-prototype-builtins */
const ATTRIBUTE_REGEX = /^((?:s(?:uppressContentEditableWarn|croll|pac)|(?:shape|image|text)Render|(?:letter|word)Spac|vHang|hang)ing|(?:on(?:AnimationIteration|C(?:o(?:mposition(?:Update|Start|End)|ntextMenu|py)|anPlayThrough|anPlay|hange|lick|ut)|(?:Animation|Touch|Load|Drag)Start|(?:(?:Duration|Volume|Rate)Chang|(?:MouseLea|(?:Touch|Mouse)Mo|DragLea)v|Paus)e|Loaded(?:Metad|D)ata|(?:(?:T(?:ransition|ouch)|Animation)E|Suspe)nd|DoubleClick|(?:TouchCanc|Whe)el|Lo(?:stPointer|ad)|TimeUpdate|(?:Mouse(?:Ent|Ov)e|Drag(?:Ent|Ov)e|Erro)r|GotPointer|MouseDown|(?:E(?:n(?:crypt|d)|mpti)|S(?:tall|eek))ed|KeyPress|(?:MouseOu|DragExi|S(?:elec|ubmi)|Rese|Inpu)t|P(?:rogress|laying)|DragEnd|Key(?:Down|Up)|(?:MouseU|Dro)p|(?:Wait|Seek)ing|Scroll|Focus|Paste|Abort|Drag|Play|Blur)Captur|alignmentBaselin|(?:limitingConeAng|xlink(?:(?:Arcr|R)o|Tit)|s(?:urfaceSca|ty|ca)|unselectab|baseProfi|fontSty|(?:focus|dragg)ab|multip|profi|tit)l|d(?:ominantBaselin|efaultValu)|onPointerLeav|a(?:uto(?:Capitaliz|Revers|Sav)|dditiv)|(?:(?:formNoValid|xlinkActu|noValid|accumul|rot)a|autoComple|decelera)t|(?:(?:attribute|item)T|datat)yp|onPointerMov|(?:attribute|glyph)Nam|playsInlin|(?:writing|input|edge)Mod|(?:formE|e)ncTyp|(?:amplitu|mo)d|(?:xlinkTy|itemSco|keyTy|slo)p|(?:xmlSpa|non)c|fillRul|(?:dateTi|na)m|r(?:esourc|ol)|xmlBas|wmod)e|(?:glyphOrientationHorizont|loc)al|(?:externalResourcesRequir|select|revers|mut)ed|c(?:o(?:lorInterpolationFilter|ord)s|o(?:lor(?:Interpolation)?|nt(?:rols|ent))|(?:ontentS(?:cript|tyle)Typ|o(?:ntentEditab|lorProfi)l|l(?:assNam|ipRul)|a(?:lcMod|ptur)|it)e|olorRendering|l(?:ipPathUnits|assID)|(?:ontrolsLis|apHeigh)t|h(?:eckedLink|a(?:llenge|rSet)|ildren|ecked)|ell(?:Spac|Padd)ing|o(?:ntextMenu|ls)|(?:rossOrigi|olSpa)n|l(?:ip(?:Path)?|ass)|ursor|[xy])|glyphOrientationVertical|d(?:angerouslySetInnerHTML|efaultChecked|ownload|isabled|isplay|[xy])|(?:s(?:trikethroughThickn|eaml)es|(?:und|ov)erlineThicknes|r(?:equiredExtension|adiu)|(?:requiredFeatur|tableValu|stitchTil|numOctav|filterR)e|key(?:(?:Splin|Tim)e|Param)|auto[Ff]ocu|header|bia)s|(?:(?:st(?:rikethroughPosi|dDevia)|(?:und|ov)erlinePosi|(?:textDecor|elev)a|orienta)tio|(?:strokeLinejo|orig)i|on(?:PointerDow|FocusI)|formActio|zoomAndPa|directio|(?:vers|act)io|rowSpa|begi|ico)n|o(?:n(?:AnimationIteration|C(?:o(?:mposition(?:Update|Start|End)|ntextMenu|py)|anPlayThrough|anPlay|hange|lick|ut)|(?:(?:Duration|Volume|Rate)Chang|(?:MouseLea|(?:Touch|Mouse)Mo|DragLea)v|Paus)e|Loaded(?:Metad|D)ata|(?:Animation|Touch|Load|Drag)Start|(?:(?:T(?:ransition|ouch)|Animation)E|Suspe)nd|DoubleClick|(?:TouchCanc|Whe)el|(?:Mouse(?:Ent|Ov)e|Drag(?:Ent|Ov)e|Erro)r|TimeUpdate|(?:E(?:n(?:crypt|d)|mpti)|S(?:tall|eek))ed|MouseDown|P(?:rogress|laying)|(?:MouseOu|DragExi|S(?:elec|ubmi)|Rese|Inpu)t|KeyPress|DragEnd|Key(?:Down|Up)|(?:Wait|Seek)ing|(?:MouseU|Dro)p|Scroll|Paste|Focus|Abort|Drag|Play|Load|Blur)|rient)|p(?:reserveA(?:spectRatio|lpha)|ointsAt[X-Z]|anose1)|(?:patternContent|ma(?:sk(?:Content)?|rker)|primitive|gradient|pattern|filter)Units|(?:(?:allowTranspar|baseFrequ)enc|re(?:ferrerPolic|adOnl)|(?:(?:st(?:roke|op)O|floodO|fillO|o)pac|integr|secur)it|visibilit|fontFamil|accessKe|propert|summar)y|(?:gradientT|patternT|t)ransform|(?:[xy]ChannelSelect|lightingCol|textAnch|floodCol|stopCol|operat|htmlF)or|(?:strokeMiterlimi|(?:specularConsta|repeatCou|fontVaria)n|(?:(?:specularE|e)xpon|renderingInt|asc)en|d(?:iffuseConsta|esce)n|(?:fontSizeAdju|lengthAdju|manife)s|baselineShif|onPointerOu|vectorEffec|(?:(?:mar(?:ker|gin)|x)H|accentH|fontW)eigh|markerStar|a(?:utoCorrec|bou)|onFocusOu|intercep|restar|forma|inlis|heigh|lis)t|(?:(?:st(?:rokeDasho|artO)|o)ffs|acceptChars|formTarg|viewTarg|srcS)et|k(?:ernel(?:UnitLength|Matrix)|[1-4])|(?:(?:enableBackgrou|markerE)n|s(?:p(?:readMetho|ee)|ee)|formMetho|(?:markerM|onInval)i|preloa|metho|kin)d|strokeDasharray|(?:onPointerCanc|lab)el|(?:allowFullScre|hidd)en|systemLanguage|(?:(?:o(?:nPointer(?:Ent|Ov)|rd)|allowReord|placehold|frameBord|paintOrd|post)e|repeatDu|d(?:efe|u))r|v(?:Mathematical|ert(?:Origin[XY]|AdvY)|alues|ocab)|(?:pointerEve|keyPoi)nts|(?:strokeLineca|onPointerU|itemPro|useMa|wra|loo)p|h(?:oriz(?:Origin|Adv)X|ttpEquiv)|(?:vI|i)deographic|unicodeRange|mathematical|vAlphabetic|u(?:nicodeBidi|[12])|(?:fontStretc|hig)h|(?:(?:mar(?:ker|gin)W|strokeW)id|azimu)th|(?:xmlnsXl|valueL)ink|mediaGroup|spellCheck|(?:text|m(?:in|ax))Length|(?:unitsPerE|optimu|fro)m|r(?:adioGroup|e(?:sults|f[XY]|l)|ows|[xy])|a(?:rabicForm|l(?:phabetic|t)|sync)|pathLength|innerHTML|xlinkShow|(?:xlinkHr|glyphR)ef|(?:tabInde|(?:sand|b)bo|viewBo)x|(?:(?:href|xml|src)La|kerni)ng|autoPlay|o(?:verflow|pen)|f(?:o(?:ntSize|rm?)|il(?:ter|l))|r(?:e(?:quired|sult|f))?|divisor|p(?:attern|oints)|unicode|d(?:efault|ata|ir)?|i(?:temRef|n2|s)|t(?:arget[XY]|o)|srcDoc|s(?:coped|te(?:m[hv]|p)|pan)|(?:width|size)s|prefix|typeof|itemID|s(?:t(?:roke|art)|hape|cope|rc)|t(?:arget|ype)|(?:stri|la)ng|a(?:ccept|s)|m(?:edia|a(?:sk|x)|in)|x(?:mlns)?|width|value|size|href|k(?:ey)?|end|low|by|i[dn]|y[12]|g[12]|x[12]|f[xy]|[yz])$/;
/* From DOMProperty */
const ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';

@@ -32,5 +27,3 @@ const ATTRIBUTE_NAME_CHAR = `${ATTRIBUTE_NAME_START_CHAR}\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040`;

/* Custom filter list */
const OTHER_ATTRIBUTE_REGEX = /^(action)/g;
const isPropValid = name => {

@@ -45,6 +38,3 @@ return (ATTRIBUTE_REGEX.test(name) || isCustomAttribute(name.toLowerCase())) && !OTHER_ATTRIBUTE_REGEX.test(name);

*/
exports.isPropValid = isPropValid;
function getValidProps(props) {

@@ -55,3 +45,2 @@ return Object.keys(props).reduce((validProps, prop) => {

}
return validProps;

@@ -65,4 +54,2 @@ }, {});

*/
function getComponentName(Component) {

@@ -79,5 +66,4 @@ if (!isReactComponent(Component)) return '';

*/
const getComponentKey = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any
const getComponentKey = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Component, index, fallback) => {

@@ -87,5 +73,3 @@ if (! /*#__PURE__*/_react.default.isValidElement(Component) && !(0, _lodash2.default)(Component)) {

}
let key;
if (Component.props && Component.props.id) {

@@ -102,3 +86,2 @@ key = Component.props.id;

}
return key;

@@ -111,6 +94,3 @@ };

*/
exports.getComponentKey = getComponentKey;
function isReact15(Component) {

@@ -124,4 +104,2 @@ return (0, _lodash2.default)(Component) && (0, _lodash.default)(Component, '_reactInternalInstance');

*/
function isReact16(Component) {

@@ -135,4 +113,2 @@ return (0, _lodash2.default)(Component) && (0, _lodash.default)(Component, '_reactInternalFiber');

*/
function isReact15Up(Component) {

@@ -148,4 +124,2 @@ return isReact15(Component) || isReact16(Component);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isReactComponent(Component) {

@@ -158,3 +132,2 @@ // Stateless functional components

}
return false;

@@ -170,4 +143,2 @@ }

*/
function getShallowDiffs(previous, next) {

@@ -196,7 +167,5 @@ const diffs = Object.keys(previous).filter(key => previous[key] !== next[key]);

*/
function getDocumentFromComponent(Component) {
if (!isReactComponent(Component)) return document; // React 16.x
if (!isReactComponent(Component)) return document;
// React 16.x
if (isReact16(Component)) {

@@ -207,7 +176,5 @@ const levelOneCheck = (0, _lodash.default)(Component, '_reactInternalFiber.return.stateNode.ownerDocument');

return levelOneCheck || levelTwoCheck || levelThreeCheck || document;
} // React 15.x
}
// React 15.x
/* istanbul ignore else */
if (isReact15(Component)) {

@@ -217,4 +184,2 @@ return (0, _lodash.default)(Component, '_reactInternalInstance._context.document', document);

/* istanbul ignore next */
return document;

@@ -227,4 +192,2 @@ }

*/
function wrapComponentName(Component, wrapperName) {

@@ -241,4 +204,2 @@ const componentName = getComponentName(Component);

*/
const isComponentOneOfType = (Component, types) => {

@@ -253,6 +214,3 @@ if (!isReactComponent(Component) || !Array.isArray(types) && typeof types !== 'string') return false;

*/
exports.isComponentOneOfType = isComponentOneOfType;
const isNativeSpanType = Component => {

@@ -262,3 +220,2 @@ const types = ['a', 'b', 'bold', 'em', 'i', 'span', 'strong', 'u'];

};
exports.isNativeSpanType = isNativeSpanType;
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