A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/core/commit/ac43b118975b17d7ce7d9e6886f8806af11bee55 below:

toRefs should be allowed on plain objects · vuejs/core@ac43b11 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+0

-15

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+0

-15

lines changed Original file line number Diff line number Diff line change

@@ -386,16 +386,6 @@ describe('reactivity/ref', () => {

386 386

expect(dummyY).toBe(5)

387 387

})

388 388 389 -

test('toRefs should warn on plain object', () => {

390 -

toRefs({})

391 -

expect(`toRefs() expects a reactive object`).toHaveBeenWarned()

392 -

})

393 - 394 -

test('toRefs should warn on plain array', () => {

395 -

toRefs([])

396 -

expect(`toRefs() expects a reactive object`).toHaveBeenWarned()

397 -

})

398 - 399 389

test('toRefs reactive array', () => {

400 390

const arr = reactive(['a', 'b', 'c'])

401 391

const refs = toRefs(arr)

Original file line number Diff line number Diff line change

@@ -9,7 +9,6 @@ import { Dep, getDepFromReactive } from './dep'

9 9

import {

10 10

type Builtin,

11 11

type ShallowReactiveMarker,

12 -

isProxy,

13 12

isReactive,

14 13

isReadonly,

15 14

isShallow,

@@ -18,7 +17,6 @@ import {

18 17

} from './reactive'

19 18

import type { ComputedRef, WritableComputedRef } from './computed'

20 19

import { ReactiveFlags, TrackOpTypes, TriggerOpTypes } from './constants'

21 -

import { warn } from './warning'

22 20 23 21

declare const RefSymbol: unique symbol

24 22

export declare const RawSymbol: unique symbol

@@ -337,9 +335,6 @@ export type ToRefs<T = any> = {

337 335

* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}

338 336

*/

339 337

export function toRefs<T extends object>(object: T): ToRefs<T> {

340 -

if (__DEV__ && !isProxy(object)) {

341 -

warn(`toRefs() expects a reactive object but received a plain one.`)

342 -

}

343 338

const ret: any = isArray(object) ? new Array(object.length) : {}

344 339

for (const key in object) {

345 340

ret[key] = propertyToRef(object, key)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4