New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@-0/browser

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@-0/browser - npm Package Compare versions

Comparing version 0.3.38 to 0.3.39

8

lib/commands/setstate.d.ts
import { Command, ICommandObject } from "@-0/keys";
export declare const createSetStateCMD: (store?: import("@thi.ng/atom").Atom<{
$$_LOAD: boolean;
$$_PATH: any[];
$$_VIEW: any;
router: {
$$_PATH: any[];
$$_LOAD: boolean;
$$_VIEW: any;
};
}>, sub$?: string) => ICommandObject;
export declare const SET_STATE: Command;
import { Atom } from "@thi.ng/atom";
export declare const $store$: Atom<{
$$_LOAD: boolean;
$$_PATH: any[];
$$_VIEW: any;
router: {
$$_PATH: any[];
$$_LOAD: boolean;
$$_VIEW: any;
};
}>;
export declare const set$$tate: (path?: string[], val?: {}, store?: Atom<{
$$_LOAD: boolean;
$$_PATH: any[];
$$_VIEW: any;
router: {
$$_PATH: any[];
$$_LOAD: boolean;
$$_VIEW: any;
};
}>) => {
$$_LOAD: boolean;
$$_PATH: any[];
$$_VIEW: any;
router: {
$$_PATH: any[];
$$_LOAD: boolean;
$$_VIEW: any;
};
};
import { Atom } from "@thi.ng/atom";
import { isPlainObject, isArray } from "@thi.ng/checks";
import { isPlainObject } from "@thi.ng/checks";
import * as API from "@-0/keys";
export const $store$ = new Atom({
[API.$$_LOAD]: true,
[API.$$_PATH]: [],
[API.$$_VIEW]: null,
});
const prep_key = "console";
export const $store$ = new Atom(API.$$_DEFAULT);
const DETOUR_KEY = "home";
const home_spread_err = `
You've attempted to swap a non-Object value into store
You've attempted to swap a non-Object payload into store
at the root path. This would overwrite any other values
in the store (which is an object). So, we've taken the
liberty of preserving both by placing your value under
a '${prep_key}' key at the root.
liberty of preserving both by placing your payload under
a '${DETOUR_KEY}' key at the root.
Consider packaging this payload as an Object to enable
it to be merged with the root Object and prevent this
annoyance in the future.
If you need to place something at the root of the state,
please consider packaging this payload as an Object to
enable it to be merged with the root Object and prevent
this annoyance in the future.
`;

@@ -24,8 +21,7 @@ export const set$$tate = (path = [], val = {}, store = $store$) => {

const both_objects = isPlainObject(x) && isPlainObject(val);
const array_to_object = isPlainObject(x) && isArray(val);
if (both_objects)
return Object.assign(Object.assign({}, x), val);
if (array_to_object && !path.length) {
if (!isPlainObject(val) && !path.length) {
console.warn(home_spread_err);
return Object.assign(Object.assign({}, x), { [prep_key]: val });
return Object.assign(Object.assign({}, x), { [DETOUR_KEY]: val });
}

@@ -32,0 +28,0 @@ return val;

import { isPlainObject } from "@thi.ng/checks";
import { _HREF_PUSHSTATE_DOM, _NOTIFY_PRERENDER_DOM, _SET_LINK_ATTRS_DOM, } from "../commands";
import { $$_VIEW, $$_LOAD, $$_PATH, DOM_NODE, URL_FULL, URL_DATA, URL_PATH, URL_PAGE, RTR_PREP, RTR_POST, RTR_PRFX, CFG_RUTR, CMD_ARGS, CMD_RESO, CMD_ERRO, DOM_BODY, STATE_DATA, STATE_PATH, } from "@-0/keys";
import { _, $$_VIEW, $$_LOAD, $$_PATH, DOM_NODE, URL_FULL, URL_DATA, URL_PATH, URL_PAGE, RTR_PREP, RTR_POST, RTR_PRFX, CFG_RUTR, CMD_ARGS, CMD_RESO, CMD_ERRO, DOM_BODY, STATE_DATA, STATE_PATH, } from "@-0/keys";
import { URL2obj } from "@-0/utils";

@@ -20,3 +20,3 @@ const route_error = (_acc, _err, _out) => console.warn("Error in URL__ROUTE:", _err);

[STATE_DATA]: _acc[URL_PATH],
[STATE_PATH]: [$$_PATH],
[STATE_PATH]: [_, $$_PATH],
}) });

@@ -41,4 +41,4 @@ const ROUTE_SUBTASK = (ACC) => [

const UNIVERSAL_ROUTING_SUBTASK = __URL__ROUTE(CFG, SET_STATE);
const _SET_ROUTE_LOADING_TRUE = Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: { [STATE_PATH]: [$$_LOAD], [STATE_DATA]: true } });
const _SET_ROUTE_LOADING_FALSE = Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: { [STATE_PATH]: [$$_LOAD], [STATE_DATA]: false } });
const _SET_ROUTE_LOADING_TRUE = Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: { [STATE_PATH]: [_, $$_LOAD], [STATE_DATA]: true } });
const _SET_ROUTE_LOADING_FALSE = Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: { [STATE_PATH]: [_, $$_LOAD], [STATE_DATA]: false } });
const ROUTE_HOT = (ACC) => [

@@ -49,3 +49,3 @@ _SET_ROUTE_LOADING_TRUE,

Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: acc => ({
[STATE_PATH]: [$$_VIEW],
[STATE_PATH]: [_, $$_VIEW],
[STATE_DATA]: acc[URL_PAGE] || (console.log(`no \`${URL_PAGE}\` found for this route`), null),

@@ -52,0 +52,0 @@ }) }),

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.3.38",
"version": "0.3.39",
"description": "Browser helpers for -0 state management, routing and the interaction between",

@@ -35,5 +35,5 @@ "main": "./lib/index.js",

"dependencies": {
"@-0/keys": "^0.3.42",
"@-0/utils": "^0.3.43",
"@-0/spool": "^0.3.33",
"@-0/keys": "^0.3.43",
"@-0/utils": "^0.3.44",
"@-0/spool": "^0.3.34",
"@thi.ng/paths": "^4.2.13",

@@ -40,0 +40,0 @@ "@thi.ng/rstream": "^6.0.20"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc