isRaw
Overview
Section titled “Overview”The isRaw function determines whether a given value has been marked as “raw” using the markRaw function, indicating that it should not be deeply converted into a deep ref when using the ref function.
Checking for Raw Value
Section titled “Checking for Raw Value”To check if a value is marked as raw, you can use the isRaw function.
import { isRaw } from 'regor'
const myValue = /* Your value here */
if (isRaw(myValue)) { console.log('The value is marked as raw.')} else { console.log('The value is not marked as raw.')}Parameters
Section titled “Parameters”value: The value you want to check for being marked as raw.
Return Value
Section titled “Return Value”- The
isRawfunction returnstrueif the providedvalueis marked as raw usingmarkRaw, andfalseotherwise.
Implementation Details
Section titled “Implementation Details”- The function checks if the provided value has a property marked with the
rawSymbolset to1, indicating that it is marked as raw.
Example
Section titled “Example”import { markRaw, isRaw } from 'regor'
const data = { name: 'Alice', age: 30, rawProperty: markRaw({ nested: 'value' }),}
// Check if rawProperty is marked as rawif (isRaw(data.rawProperty)) { console.log('The rawProperty is marked as raw.')} else { console.log('The rawProperty is not marked as raw.')}