Skip to content

Commit

Permalink
Meta tweaks (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richienb authored Feb 11, 2021
1 parent 1e74a73 commit b6181b3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const isObj = require('is-obj');
const isObject = require('is-obj');

const disallowedKeys = new Set([
'__proto__',
Expand Down Expand Up @@ -33,7 +33,7 @@ function getPathSegments(path) {

module.exports = {
get(object, path, value) {
if (!isObj(object) || typeof path !== 'string') {
if (!isObject(object) || typeof path !== 'string') {
return value === undefined ? object : value;
}

Expand Down Expand Up @@ -63,7 +63,7 @@ module.exports = {
},

set(object, path, value) {
if (!isObj(object) || typeof path !== 'string') {
if (!isObject(object) || typeof path !== 'string') {
return object;
}

Expand All @@ -73,7 +73,7 @@ module.exports = {
for (let i = 0; i < pathArray.length; i++) {
const p = pathArray[i];

if (!isObj(object[p])) {
if (!isObject(object[p])) {
object[p] = {};
}

Expand All @@ -88,7 +88,7 @@ module.exports = {
},

delete(object, path) {
if (!isObj(object) || typeof path !== 'string') {
if (!isObject(object) || typeof path !== 'string') {
return false;
}

Expand All @@ -104,14 +104,14 @@ module.exports = {

object = object[p];

if (!isObj(object)) {
if (!isObject(object)) {
return false;
}
}
},

has(object, path) {
if (!isObj(object) || typeof path !== 'string') {
if (!isObject(object) || typeof path !== 'string') {
return false;
}

Expand All @@ -122,7 +122,7 @@ module.exports = {

// eslint-disable-next-line unicorn/no-for-loop
for (let i = 0; i < pathArray.length; i++) {
if (isObj(object)) {
if (isObject(object)) {
if (!(pathArray[i] in object)) {
return false;
}
Expand Down

0 comments on commit b6181b3

Please sign in to comment.