react-from-dom
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -34,4 +34,5 @@ var __read = (this && this.__read) || function (o, n) { | ||
var result = ''; | ||
for (var i = length; i > 0; --i) | ||
for (var i = length; i > 0; --i) { | ||
result += characters[Math.round(Math.random() * (characters.length - 1))]; | ||
} | ||
return result; | ||
@@ -38,0 +39,0 @@ } |
@@ -28,5 +28,6 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -46,3 +47,3 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ | ||
} | ||
__spread(node.attributes).forEach(function (d) { | ||
__spreadArray([], __read(node.attributes)).forEach(function (d) { | ||
switch (d.name) { | ||
@@ -90,3 +91,3 @@ // this is manually handled above, so break; | ||
function parseChildren(childNodeList, level, options) { | ||
var children = __spread(childNodeList).map(function (node, index) { | ||
var children = __spreadArray([], __read(childNodeList)).map(function (node, index) { | ||
return convertFromNode(node, __assign(__assign({}, options), { index: index, level: level + 1 })); | ||
@@ -93,0 +94,0 @@ }) |
@@ -38,4 +38,5 @@ "use strict"; | ||
var result = ''; | ||
for (var i = length; i > 0; --i) | ||
for (var i = length; i > 0; --i) { | ||
result += characters[Math.round(Math.random() * (characters.length - 1))]; | ||
} | ||
return result; | ||
@@ -42,0 +43,0 @@ } |
@@ -29,5 +29,6 @@ "use strict"; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -49,3 +50,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
} | ||
__spread(node.attributes).forEach(function (d) { | ||
__spreadArray([], __read(node.attributes)).forEach(function (d) { | ||
switch (d.name) { | ||
@@ -93,3 +94,3 @@ // this is manually handled above, so break; | ||
function parseChildren(childNodeList, level, options) { | ||
var children = __spread(childNodeList).map(function (node, index) { | ||
var children = __spreadArray([], __read(childNodeList)).map(function (node, index) { | ||
return convertFromNode(node, __assign(__assign({}, options), { index: index, level: level + 1 })); | ||
@@ -96,0 +97,0 @@ }) |
{ | ||
"name": "react-from-dom", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Convert HTML/XML source code or DOM nodes to React elements", | ||
@@ -35,39 +35,33 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"devDependencies": { | ||
"@gilbarbara/eslint-config": "^0.1.4", | ||
"@gilbarbara/prettier-config": "^0.1.0", | ||
"@gilbarbara/tsconfig": "^0.1.0", | ||
"@size-limit/preset-small-lib": "^4.9.2", | ||
"@types/enzyme": "^3.10.8", | ||
"@size-limit/preset-small-lib": "^5.0.1", | ||
"@types/enzyme": "^3.10.9", | ||
"@types/enzyme-adapter-react-16": "^1.0.6", | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.28", | ||
"@types/react": "^17.0.2", | ||
"@types/react-dom": "^17.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"del-cli": "^3.0.1", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^16.3.0", | ||
"@types/react": "^17.0.14", | ||
"@types/react-dom": "^17.0.9", | ||
"@typescript-eslint/eslint-plugin": "^4.28.2", | ||
"@typescript-eslint/parser": "^4.28.2", | ||
"del-cli": "^4.0.0", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.6", | ||
"eslint": "^7.20.0", | ||
"eslint-config-airbnb": "^18.2.1", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-react": "^7.22.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"fetch-mock": "^9.11.0", | ||
"husky": "^4.3.8", | ||
"is-ci-cli": "^2.2.0", | ||
"jest": "^26.6.3", | ||
"jest": "^27.0.6", | ||
"jest-chain": "^1.1.5", | ||
"jest-enzyme": "^7.1.2", | ||
"jest-extended": "^0.11.5", | ||
"jest-watch-typeahead": "^0.6.1", | ||
"prettier": "^2.2.1", | ||
"jest-watch-typeahead": "^0.6.4", | ||
"prettier": "^2.3.2", | ||
"react": "^16.14.0", | ||
"react-dom": "^16.14.0", | ||
"repo-tools": "^0.2.1", | ||
"serve": "^11.3.2", | ||
"size-limit": "^4.9.2", | ||
"ts-jest": "^26.5.1", | ||
"typescript": "^4.1.5" | ||
"repo-tools": "^0.2.2", | ||
"serve": "^12.0.0", | ||
"size-limit": "^5.0.1", | ||
"ts-jest": "^27.0.3", | ||
"typescript": "^4.3.5" | ||
}, | ||
@@ -81,17 +75,18 @@ "scripts": { | ||
"clean": "del lib/* && del esm/*", | ||
"lint": "eslint --ext .ts,.tsx src test", | ||
"test": "is-ci \"test:coverage\" \"test:watch\"", | ||
"test:coverage": "jest --coverage --bail", | ||
"test:watch": "jest --watch --verbose", | ||
"lint": "eslint --ext .ts,.tsx src test", | ||
"test:watch": "jest --watchAll --verbose", | ||
"typecheck": "tsc --noEmit", | ||
"format": "prettier \"**/*.{js,jsx,json,yml,yaml,css,less,scss,ts,tsx,md,graphql,mdx}\" --write", | ||
"validate": "npm run lint && npm run test:coverage && npm run build && npm run size", | ||
"validate": "npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run size", | ||
"size": "size-limit", | ||
"prepublishOnly": "npm run validate" | ||
}, | ||
"prettier": { | ||
"jsxBracketSameLine": false, | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
"eslintConfig": { | ||
"extends": [ | ||
"@gilbarbara/eslint-config" | ||
] | ||
}, | ||
"prettier": "@gilbarbara/prettier-config", | ||
"size-limit": [ | ||
@@ -98,0 +93,0 @@ { |
export const styleToObject = (input: string): Record<string, any> => { | ||
const attributes = input.split(/ ?; ?/); | ||
return attributes.reduce((acc: Record<string, any>, d: string) => { | ||
@@ -21,4 +22,5 @@ const [key, value] = d.split(/ ?: ?/); | ||
for (let i = length; i > 0; --i) | ||
for (let i = length; i > 0; --i) { | ||
result += characters[Math.round(Math.random() * (characters.length - 1))]; | ||
} | ||
@@ -25,0 +27,0 @@ return result; |
/* eslint-disable @typescript-eslint/no-use-before-define */ | ||
import * as React from 'react'; | ||
import { noTextChildNodes, possibleStandardNames, randomString, styleToObject } from './helpers'; | ||
@@ -16,5 +17,5 @@ | ||
interface Attributes { | ||
[index: string]: any; | ||
key: string; | ||
[index: string]: any; | ||
} | ||
@@ -48,3 +49,3 @@ | ||
[...node.attributes].forEach((d) => { | ||
[...node.attributes].forEach(d => { | ||
switch (d.name) { | ||
@@ -198,2 +199,3 @@ // this is manually handled above, so break; | ||
} | ||
return null; | ||
@@ -219,2 +221,3 @@ } | ||
} | ||
const { nodeOnly = false, selector = 'body > *', type = 'text/html' } = options; | ||
@@ -221,0 +224,0 @@ |
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
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
100280
31
1917