-
-
Notifications
You must be signed in to change notification settings - Fork 0
unify isWrapped()
Eugene Lazutkin edited this page Apr 3, 2026
·
1 revision
Checks if a value is wrapped (open, soft, or any other wrap type).
Type guard function to check if a value is a Wrap instance. Wrap objects are created by open(), soft(), and other wrapper functions.
import {open, soft, isWrapped} from 'deep6/unify.js';
const openObj = open({a: 1});
const softObj = soft({b: 2});
isWrapped(openObj); // true
isWrapped(softObj); // true
isWrapped({a: 1}); // false - plain object
isWrapped(null); // false
isWrapped('string'); // falseArguments:
-
o— any value to check.
Returns true if o is a Wrap instance, false otherwise.
This is the most general check for wrapped objects. For more specific checks:
Wrapped objects have these characteristics:
- They are instances of the internal
Wrapclass - They have a
typeproperty indicating the wrap type - They have an
objectproperty containing the wrapped value