Skip to content

Commit

Permalink
fix(utils): fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ssi02014 committed Jan 29, 2024
1 parent aa4c194 commit cab1281
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 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 isHasOwnProperty = Object.prototype.hasOwnProperty.call(array, index);
if (!isHasOwnProperty) {
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(array, index);
if (!hasOwnPropertyCheck) {
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 isHasOwnProperty = Object.prototype.hasOwnProperty.call(object, property);
if (isHasOwnProperty) {
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(object, property);
if (hasOwnPropertyCheck) {
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: 7 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ function addToSet(set, array, transformCaseFunc = stringToLowerCase) {
*/
function cleanArray(array) {
for (let index = 0; index < array.length; index++) {
const isHasOwnProperty = Object.prototype.hasOwnProperty.call(array, index);
const hasOwnPropertyCheck = Object.prototype.hasOwnProperty.call(
array,
index
);

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

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

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

0 comments on commit cab1281

Please sign in to comment.