@harlem/utilities
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -66,8 +66,8 @@ // src/type/get-type.ts | ||
function clone(value) { | ||
if (typeof value !== "object" || value === null) { | ||
return value; | ||
const input = unref(value); | ||
if (typeof input !== "object" || input === null) { | ||
return input; | ||
} | ||
const type = getType(value); | ||
const type = getType(input); | ||
const cloner = CLONE_MAP[type] || CLONE_MAP.default; | ||
const input = unref(value); | ||
return cloner(input); | ||
@@ -74,0 +74,0 @@ } |
@@ -107,8 +107,8 @@ var HarlemUtilities = (() => { | ||
function clone(value) { | ||
if (typeof value !== "object" || value === null) { | ||
return value; | ||
const input = (0, import_vue.unref)(value); | ||
if (typeof input !== "object" || input === null) { | ||
return input; | ||
} | ||
const type = getType(value); | ||
const type = getType(input); | ||
const cloner = CLONE_MAP[type] || CLONE_MAP.default; | ||
const input = (0, import_vue.unref)(value); | ||
return cloner(input); | ||
@@ -115,0 +115,0 @@ } |
@@ -66,8 +66,8 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/type/get-type.ts | ||
function clone(value) { | ||
if (typeof value !== "object" || value === null) { | ||
return value; | ||
const input = _vue.unref.call(void 0, value); | ||
if (typeof input !== "object" || input === null) { | ||
return input; | ||
} | ||
const type = getType(value); | ||
const type = getType(input); | ||
const cloner = CLONE_MAP[type] || CLONE_MAP.default; | ||
const input = _vue.unref.call(void 0, value); | ||
return cloner(input); | ||
@@ -74,0 +74,0 @@ } |
{ | ||
"name": "@harlem/utilities", | ||
"amdName": "harlemUtilities", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"license": "MIT", | ||
@@ -46,3 +46,3 @@ "author": "Andrew Courtice <andrewcourtice@users.noreply.github.com>", | ||
}, | ||
"gitHead": "3b9ddf9b7341ca7149bad495c20fb8e77f5a0e68" | ||
"gitHead": "fa89b7803d19dfa38e6c7ed5afea25f6e986e95c" | ||
} |
@@ -5,3 +5,3 @@ import getType from '../type/get-type'; | ||
unref, | ||
UnwrapRef | ||
UnwrapRef, | ||
} from 'vue'; | ||
@@ -90,11 +90,12 @@ | ||
export default function clone<TValue = unknown>(value: TValue): UnwrapRef<TValue> { | ||
if (typeof value !== 'object' || value === null) { | ||
return value as UnwrapRef<TValue>; | ||
const input = unref(value); | ||
if (typeof input !== 'object' || input === null) { | ||
return input as UnwrapRef<TValue>; | ||
} | ||
const type = getType(value); | ||
const type = getType(input); | ||
const cloner = CLONE_MAP[type] || CLONE_MAP.default; | ||
const input = unref(value); | ||
return cloner(input) as UnwrapRef<TValue>; | ||
} |
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
44098