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

@actualwave/type-checkers

v0.1.13

Published

Framework for parameter/value analysis on access or mutation, used for type check in runtime.

Downloads

8

Readme

JS-Type-Checkers

Coverage Status Build Status

Library that reports assignments of values or function arguments, return values with wrong types.

    const myObj = {
      val1: true,
      val2: 'string',
      method: () => {
        return 'str';
      },
      val3: 123,
      list: [],
      child: {
        val1: true,
        val2: 'string',
        method: () => {
          return {};
        },
        val3: 123,
      },
    };

    const typeChecked = TypeCheckers.create(myObj);

    // this code will work as intended, but type errors should spam
    typeChecked.val1 = 'abc';
    typeChecked.val2 = {};

    // will recognize array and show error
    typeChecked.list = {};

    // optional parameter "deep" is set to true by default, so all objects coming from properties will be wrapped too
    typeChecked.child.val3 = false;

    // getting property with wrong type should shows error log too
    const myVal = typeChecked.val2;

    // save types for method
    typeChecked.method(1, 'a', false);

    // show error logs for arguments mismatch
    typeChecked.method('a', 1, false);

TODOs

  1. +Add global methods to copy and apply configs, they should work with typeChecker.mergeConfig() method
  2. +Add possibility to merge objects with type information using mergeConfigs()
  3. +Decide, when setting value to a property, should this value be wrapped?
  4. +Decide, when calling function, should arguments and return value be wrapped?
  5. ?Lazy typings for Arrays or apply one type(from first element) for all items. Indexed type is available, still don't know about lazy arrays
  6. +Implement "createDeep()"
  7. Cache child info for arguments
  8. +Add ability to setup custom value validators for default type checker
  9. +Ignore accessing functions from prototype all the time
  10. Add option to ignore any kind of properties available via prototype
  11. +Implement replaceProperty() -> property()
  12. +Add possibility to make proxy config be part of target's info
  13. +Move primitive type checker into separate repo
  14. Add possibility to register ignored names which will be just skipped whatewer is placed in, probably could be added to ExtendedTypeChecker.
  15. Add methods to convert info objects into primitives and back so they could be stored, would be good to have a system that permanently stores types info for consecutive runs.