npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

funcproxy

v1.0.14

Published

Wrapper for Proxy that passes all handler methods to a function

Downloads

8

Readme

#Wrapper for Proxy that passes all handler methods to a function

##Install

$ npm install funcproxy

##Requires funcproxy requires a Javascript version that supports the following features:

Proxy
Object.freeze

For example, Node version 6.4 or higher.

##What it does Javascript's Proxy constructor takes two arguments: the target of the proxy and a handler object that can contain methods from the following list:

getPrototypeOf
setPrototypeOf
isExtensible
preventExtension
getOwnPropertyDescriptor
defineProperty
has
get
set
deleteProperty
ownKeys
apply
construct

Each of these functions defines some kind of behavior for the proxy.

The point of funcproxy is to be able to set up a proxy by passing in one general function that can handle any and all of the above handler methods, so that it is not necessary to set up separate handler methods.

##Using funcproxy to create a proxy instance The funcproxy module exports a function. This function takes one argument, an object with setup options, and returns a proxy. The possible options that can be passed in are described in the next section. If no arguments at all are provided to the funcproxy function, the case is treated the same as if an empty object had been passed in.

##Options

  • target - The target of the proxy. If this option is missing, a newly-created object with no properties will be used as the proxy target.
  • isRevocable - Determines whether the proxy will be revocable or not. If this option is missing, it will default to false.
  • func - A function that controls the behavior of the proxy. When any handler method is invoked on the proxy, func is called with one argument, an object that contains the following properties:
    • method - The handler method. For example, 'set' or 'ownKeys'.
    • methodArgsArray - An array of the original arguments that the proxy passed into the handler method.
    • methodArgs - An object that contains the handler method arguments as properties, with appropriate keys. For example, if the handler method is get, the methodArgs object will have the properties 'target', 'property', and 'receiver'.
    • methodThis - The this value in the handler method.
    • options - The setup options of this funcproxy instance. These options are frozen and cannot be modified.
    • proxy - The proxy.
    • funcproxy - The function exported by the funcproxy module. If the func option is missing, an empty function (a function that does nothing) will be used.
  • methods - The handler methods that will be used by the proxy. This option can be given the following values: true to use all methods, false to use no methods, or a string array of method names to use just those methods. If this option is missing, all methods will be used.