Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createHook(options: CreateHookOptions) {
const composedHooks = toArray(options.compose) as Hook[];
const __useOptions = (hookOptions: O, htmlProps: P) => {
// Call the current hook's useOptions first
if (options.useOptions) {
hookOptions = options.useOptions(hookOptions, htmlProps);
}
// If there's name, call useOptions from the system context
if (options.name) {
hookOptions = useOptions(options.name, hookOptions, htmlProps);
}
return hookOptions;
};
const useHook: Hook = (
hookOptions = {} as O,
htmlProps = {} as P,
export function unstable_setIn<
T extends Record | Array,
P extends DeepPath
>(object: T, path: P, value: any): T {
const pathArray = toArray(path) as DeepPathArray;
const [key, ...keys] = pathArray;
if (key == null) return object;
const obj = isInteger(key) ? object || [] : object || {};
const result = keys.length ? unstable_setIn(obj[key], keys, value) : value;
if (isInteger(key)) {
if (object) {
return [
...object.slice(0, Number(key)),
result,
...object.slice(Number(key) + 1)
] as T;
}
return [result] as T;