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

@agoric/make-hardener

Package Overview
Dependencies
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agoric/make-hardener - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

27

dist/make-hardener.umd.js

@@ -28,2 +28,4 @@ (function (global, factory) {

// @ts-check
const { freeze, getOwnPropertyDescriptors, getPrototypeOf } = Object;

@@ -33,3 +35,9 @@ const { ownKeys } = Reflect;

/**
* @typedef {<T>(root: T) => T} Hardener
*/
/**
* Create a `harden` function.
*
* @returns {Hardener}
*/

@@ -40,2 +48,7 @@ function makeHardener() {

const { harden } = {
/**
* @template T
* @param {T} root
* @returns {T}
*/
harden(root) {

@@ -47,3 +60,7 @@ const toFreeze = new Set();

// add it to toFreeze.
function enqueue(val, path) {
/**
* @param {any} val
* @param {string} [path]
*/
function enqueue(val, path = undefined) {
if (Object(val) !== val) {

@@ -67,2 +84,5 @@ // ignore primitives

/**
* @param {any} obj
*/
function freezeAndTraverse(obj) {

@@ -97,3 +117,6 @@ // Now freeze the object to ensure reactive

// this is a data property.
const desc = descs[name];
// The 'name' may be a symbol, and TypeScript doesn't like us to
// index arbitrary symbols on objects, so we pretend they're just
// strings.
const desc = descs[/** @type {string} */ (name)];
if ('value' in desc) {

@@ -100,0 +123,0 @@ // todo uncurried form

2

package.json
{
"name": "@agoric/make-hardener",
"version": "0.1.2",
"version": "0.1.3",
"description": "Create a 'hardener' which freezes the API surface of a set of objects",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,2 +22,4 @@ // Adapted from SES/Caja - Copyright (C) 2011 Google Inc.

// @ts-check
const { freeze, getOwnPropertyDescriptors, getPrototypeOf } = Object;

@@ -27,3 +29,9 @@ const { ownKeys } = Reflect;

/**
* @typedef {<T>(root: T) => T} Hardener
*/
/**
* Create a `harden` function.
*
* @returns {Hardener}
*/

@@ -34,2 +42,7 @@ function makeHardener() {

const { harden } = {
/**
* @template T
* @param {T} root
* @returns {T}
*/
harden(root) {

@@ -41,3 +54,7 @@ const toFreeze = new Set();

// add it to toFreeze.
function enqueue(val, path) {
/**
* @param {any} val
* @param {string} [path]
*/
function enqueue(val, path = undefined) {
if (Object(val) !== val) {

@@ -61,2 +78,5 @@ // ignore primitives

/**
* @param {any} obj
*/
function freezeAndTraverse(obj) {

@@ -91,3 +111,6 @@ // Now freeze the object to ensure reactive

// this is a data property.
const desc = descs[name];
// The 'name' may be a symbol, and TypeScript doesn't like us to
// index arbitrary symbols on objects, so we pretend they're just
// strings.
const desc = descs[/** @type {string} */ (name)];
if ('value' in desc) {

@@ -94,0 +117,0 @@ // todo uncurried form

export default makeHardener;
export type Hardener = <T>(root: T) => T;
/**
* @typedef {<T>(root: T) => T} Hardener
*/
/**
* Create a `harden` function.
*
* @returns {Hardener}
*/
declare function makeHardener(): (root: any) => any;
declare function makeHardener(): Hardener;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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