@voiceflow/common
Advanced tools
Comparing version 8.2.1 to 8.2.2
@@ -14,2 +14,3 @@ import { AnyRecord, Struct } from "../../types"; | ||
export declare const isObject: (obj: unknown) => obj is Struct; | ||
export declare const isPlainObject: (obj: unknown) => obj is Struct; | ||
export declare const hasProperty: <T, K extends string | keyof T>(obj: T, key: K) => obj is T & Record<K, unknown>; | ||
@@ -16,0 +17,0 @@ export declare const omit: <T, K extends keyof T>(obj: T, keys: K[]) => Omit<T, K>; |
@@ -6,3 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.shallowPartialEquals = exports.mapValue = exports.mapEntry = exports.filterEntries = exports.omitBy = exports.pickBy = exports.pick = exports.omit = exports.hasProperty = exports.isObject = exports.selectValue = exports.selectKey = exports.selectID = exports.selectField = exports.shallowEquals = void 0; | ||
exports.shallowPartialEquals = exports.mapValue = exports.mapEntry = exports.filterEntries = exports.omitBy = exports.pickBy = exports.pick = exports.omit = exports.hasProperty = exports.isPlainObject = exports.isObject = exports.selectValue = exports.selectKey = exports.selectID = exports.selectField = exports.shallowEquals = void 0; | ||
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject")); | ||
var shallowequal_1 = require("shallowequal"); | ||
@@ -17,2 +18,4 @@ Object.defineProperty(exports, "shallowEquals", { enumerable: true, get: function () { return __importDefault(shallowequal_1).default; } }); | ||
exports.isObject = isObject; | ||
const isPlainObject = (obj) => (0, isPlainObject_1.default)(obj); | ||
exports.isPlainObject = isPlainObject; | ||
const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key); | ||
@@ -19,0 +22,0 @@ exports.hasProperty = hasProperty; |
@@ -34,3 +34,3 @@ "use strict"; | ||
return mapArray(value); | ||
if ((0, common_1.isObject)(value)) | ||
if ((0, common_1.isPlainObject)(value)) | ||
return mapObject(value); | ||
@@ -71,3 +71,3 @@ return mapFunction(value, key); | ||
return mapArray(value); | ||
if ((0, common_1.isObject)(value)) | ||
if ((0, common_1.isPlainObject)(value)) | ||
return mapObject(value); | ||
@@ -74,0 +74,0 @@ return value; |
@@ -14,2 +14,3 @@ import { AnyRecord, Struct } from "../../types"; | ||
export declare const isObject: (obj: unknown) => obj is Struct; | ||
export declare const isPlainObject: (obj: unknown) => obj is Struct; | ||
export declare const hasProperty: <T, K extends string | keyof T>(obj: T, key: K) => obj is T & Record<K, unknown>; | ||
@@ -16,0 +17,0 @@ export declare const omit: <T, K extends keyof T>(obj: T, keys: K[]) => Omit<T, K>; |
@@ -0,1 +1,2 @@ | ||
import _isPlainObject from 'lodash/isPlainObject'; | ||
export { default as shallowEquals } from 'shallowequal'; | ||
@@ -7,2 +8,3 @@ export const selectField = (field) => (obj) => obj[field]; | ||
export const isObject = (obj) => obj !== null && typeof obj === 'object'; | ||
export const isPlainObject = (obj) => _isPlainObject(obj); | ||
export const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key); | ||
@@ -9,0 +11,0 @@ export const omit = (obj, keys) => { |
@@ -1,2 +0,2 @@ | ||
import { isObject } from './common'; | ||
import { isPlainObject } from './common'; | ||
export const deepMap = (object, mapFunction, options = {}) => { | ||
@@ -31,3 +31,3 @@ const cache = new WeakMap(); | ||
return mapArray(value); | ||
if (isObject(value)) | ||
if (isPlainObject(value)) | ||
return mapObject(value); | ||
@@ -67,3 +67,3 @@ return mapFunction(value, key); | ||
return mapArray(value); | ||
if (isObject(value)) | ||
if (isPlainObject(value)) | ||
return mapObject(value); | ||
@@ -70,0 +70,0 @@ return value; |
{ | ||
"name": "@voiceflow/common", | ||
"description": "Junk drawer of utility functions", | ||
"version": "8.2.1", | ||
"version": "8.2.2", | ||
"author": "Voiceflow", | ||
@@ -63,3 +63,3 @@ "bugs": { | ||
"types": "build/cjs/index.d.ts", | ||
"gitHead": "1072388fc005badfb9ce9a2101650a74fa2ce2b1" | ||
"gitHead": "c97e67103b9cd1dbf4830935ed4098c3a1f9156f" | ||
} |
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
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
478179
7478