Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ag-reactive

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ag-reactive - npm Package Compare versions

Comparing version 1.0.6 to 1.0.8

Builder.d.ts

12

index.d.ts

@@ -0,1 +1,4 @@

import { Wrapper } from "./Wrapper";
import { Delta } from "./Types";
import { Builder } from "./Builder";
export declare const RawKey = "__raw";

@@ -5,3 +8,10 @@ export declare const ReactiveKey = "__reactive";

export declare function markRaw(value: any): any;
export declare function isReactive<T>(value: T): boolean;
export declare function isReactive(value: any): value is {
__reactive: Wrapper;
};
export declare function reactive<T>(raw: T): T;
export declare function observe(obj: any, cb: (delta: Delta) => void): {
id: string;
stop(): void;
};
export declare function rebuild<T = any>(id: string): Builder<T>;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.reactive = exports.isReactive = exports.markRaw = exports.isRaw = exports.ReactiveKey = exports.RawKey = void 0;
var ReactiveObject_1 = require("./ReactiveObject");
var console_1 = require("./console");
(0, console_1.override_console)();
exports.rebuild = exports.observe = exports.reactive = exports.isReactive = exports.markRaw = exports.isRaw = exports.ReactiveKey = exports.RawKey = void 0;
var Wrapper_1 = require("./Wrapper");
var Observer_1 = require("./Observer");
var pretty_format_1 = __importDefault(require("pretty-format"));
var Builder_1 = require("./Builder");
exports.RawKey = '__raw';

@@ -16,3 +20,4 @@ exports.ReactiveKey = '__reactive';

|| value instanceof Date
|| (value === null || value === void 0 ? void 0 : value[exports.RawKey]);
|| (value === null || value === void 0 ? void 0 : value[exports.RawKey])
|| typeof value === 'function';
}

@@ -40,3 +45,2 @@ exports.isRaw = isRaw;

exports.isReactive = isReactive;
var id = 0;
function reactive(raw) {

@@ -46,3 +50,3 @@ var _a, _b;

return raw;
var obj = new ReactiveObject_1.ReactiveObject(id++, Array.isArray(raw));
var obj = new Wrapper_1.Wrapper(Array.isArray(raw));
for (var key in raw) {

@@ -55,1 +59,20 @@ var value = ((_b = (_a = Object.getOwnPropertyDescriptor(raw, key)) === null || _a === void 0 ? void 0 : _a.get) !== null && _b !== void 0 ? _b : raw[key]);

exports.reactive = reactive;
function observe(obj, cb) {
if (!isReactive(obj)) {
throw 'can only observe reactive object';
}
return (0, Observer_1.observe)(obj.__reactive, cb);
}
exports.observe = observe;
function rebuild(id) {
return new Builder_1.Builder(id);
}
exports.rebuild = rebuild;
var consoleLog = console.log;
console.log = function () {
var d = [];
for (var _i = 0; _i < arguments.length; _i++) {
d[_i] = arguments[_i];
}
consoleLog.apply(void 0, d.map(function (v) { return (0, pretty_format_1.default)(v); }));
};
{
"name": "ag-reactive",
"version": "1.0.6",
"version": "1.0.8",
"description": "",

@@ -10,3 +10,7 @@ "author": "",

},
"dependencies": {
"consola": "^3.2.3",
"pretty-format": "^29.7.0"
},
"bin": {}
}
console.d.ts
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