Skip to content

Commit

Permalink
fix(utils): fixed isPropertyExist naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ssi02014 committed Jan 29, 2024
1 parent cab1281 commit 4abee1e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 23 deletions.
8 changes: 4 additions & 4 deletions dist/purify.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.cjs.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/purify.es.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ function addToSet(set, array) {
*/
function cleanArray(array) {
for (let index = 0; index < array.length; index++) {
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(array, index);
if (!hasOwnPropertyCheck) {
const isPropertyExist = Object.prototype.hasOwnProperty.call(array, index);
if (!isPropertyExist) {
array[index] = null;
}
}
Expand All @@ -137,8 +137,8 @@ function cleanArray(array) {
function clone(object) {
const newObject = create(null);
for (const [property, value] of entries(object)) {
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(object, property);
if (hasOwnPropertyCheck) {
const isPropertyExist = Object.prototype.hasOwnProperty.call(object, property);
if (isPropertyExist) {
if (Array.isArray(value)) {
newObject[property] = cleanArray(value);
} else if (value && typeof value === 'object' && value.constructor === Object) {
Expand Down
2 changes: 1 addition & 1 deletion dist/purify.es.mjs.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/purify.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/purify.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/purify.min.js.map

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,9 @@ function addToSet(set, array, transformCaseFunc = stringToLowerCase) {
*/
function cleanArray(array) {
for (let index = 0; index < array.length; index++) {
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(
array,
index
);
const isPropertyExist = Object.prototype.hasOwnProperty.call(array, index);

if (!hasOwnPropertyCheck) {
if (!isPropertyExist) {
array[index] = null;
}
}
Expand All @@ -138,12 +135,12 @@ function clone(object) {
const newObject = create(null);

for (const [property, value] of entries(object)) {
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(
const isPropertyExist = Object.prototype.hasOwnProperty.call(
object,
property
);

if (hasOwnPropertyCheck) {
if (isPropertyExist) {
if (Array.isArray(value)) {
newObject[property] = cleanArray(value);
} else if (
Expand Down

0 comments on commit 4abee1e

Please sign in to comment.