react-typing-animation
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -412,3 +412,3 @@ 'use strict'; | ||
if (children !== undefined && JSON.stringify(children) !== JSON.stringify(this.props.children)) { | ||
if (children !== undefined && JSON.stringify(children, (0, _utils.getCircularReplacer)()) !== JSON.stringify(this.props.children, (0, _utils.getCircularReplacer)())) { | ||
this.resetState(); | ||
@@ -415,0 +415,0 @@ } |
@@ -6,4 +6,6 @@ 'use strict'; | ||
}); | ||
exports.replaceTreeText = exports.extractText = exports.randomize = exports.gaussianRandomInRange = exports.randomInRange = undefined; | ||
exports.getCircularReplacer = exports.replaceTreeText = exports.extractText = exports.randomize = exports.gaussianRandomInRange = exports.randomInRange = undefined; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _react = require('react'); | ||
@@ -110,2 +112,16 @@ | ||
return traverse(tree, txt.slice()); | ||
}; | ||
var getCircularReplacer = exports.getCircularReplacer = function getCircularReplacer() { | ||
var seen = new WeakSet(); | ||
return function (key, value) { | ||
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null) { | ||
if (seen.has(value)) { | ||
return; | ||
} | ||
seen.add(value); | ||
} | ||
return value; | ||
}; | ||
}; |
{ | ||
"name": "react-typing-animation", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"author": "Adam King https://github.com/adamjking3", | ||
@@ -18,6 +18,4 @@ "homepage": "https://adamjking3.github.io/react-typing-animation-example/", | ||
"scripts": { | ||
"build": | ||
"mkdir -p ./dist && NODE_ENV=production babel ./src --out-dir ./dist", | ||
"build:example": | ||
"npm run clean && webpack --progress --config ./example/webpack.config.js", | ||
"build": "mkdir -p ./dist && NODE_ENV=production babel ./src --out-dir ./dist", | ||
"build:example": "npm run clean && webpack --progress --config ./example/webpack.config.js", | ||
"clean": "rimraf ./example/build/* && npm run lint", | ||
@@ -75,6 +73,12 @@ "lint": "eslint --ignore-path .gitignore .", | ||
"babel": { | ||
"presets": ["env", "react-app"] | ||
"presets": [ | ||
"env", | ||
"react-app" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": ["react-app", "prettier"] | ||
"extends": [ | ||
"react-app", | ||
"prettier" | ||
] | ||
}, | ||
@@ -87,3 +91,6 @@ "prettier": { | ||
}, | ||
"eslintIgnore": ["dist", "example/build"] | ||
"eslintIgnore": [ | ||
"dist", | ||
"example/build" | ||
] | ||
} |
@@ -70,2 +70,3 @@ # React-typing-animation | ||
| className | string | | no | | ||
| cursorClassName | string | | no | | ||
| cursor | React node | [`<Cursor />`](https://github.com/adamjking3/react-typing-animation/blob/master/src/Cursor.js) | no | | ||
@@ -72,0 +73,0 @@ | speed | number | 50 (ms) | no | |
@@ -5,3 +5,8 @@ import React, { Component } from 'react'; | ||
import { randomize, extractText, replaceTreeText } from './utils'; | ||
import { | ||
randomize, | ||
extractText, | ||
replaceTreeText, | ||
getCircularReplacer, | ||
} from './utils'; | ||
import Backspace from './Backspace'; | ||
@@ -22,3 +27,4 @@ import Reset from './Reset'; | ||
children !== undefined && | ||
JSON.stringify(children) !== JSON.stringify(this.props.children) | ||
JSON.stringify(children, getCircularReplacer()) !== | ||
JSON.stringify(this.props.children, getCircularReplacer()) | ||
) { | ||
@@ -25,0 +31,0 @@ this.resetState(); |
@@ -118,1 +118,15 @@ import React, { Children } from 'react'; | ||
}; | ||
export const getCircularReplacer = () => { | ||
const seen = new WeakSet(); | ||
return (key, value) => { | ||
if (typeof value === 'object' && value !== null) { | ||
if (seen.has(value)) { | ||
return; | ||
} | ||
seen.add(value); | ||
} | ||
return value; | ||
}; | ||
}; |
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
6132473
1453
166