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

@gloch96/typed-getters

v2.0.0

Published

> **IDEA!** : Using [JSDocs](https://jsdoc.app/) in tandem with **typed-getters** could become a lightweight alternative over TypeScript .

Downloads

5

Readme

Project name: typed-getters (2024 edition)

IDEA! : Using JSDocs in tandem with typed-getters could become a lightweight alternative over TypeScript .

MOTIVATION

Unlike default EcmaScript (JavaScript) constructors such as String() defaults to '' | Number() defaults to 0 | Symbol() defaults to Symbol() | Boolean() defaults to false whereas each by specification defaults to some value, the typed-getters helps to maintain consistency among JavaScript primitive simply returning a graceful undefined

HOW TO USE

Installation

Run the command npm i -g @gloch96/typed-getters : this will install the util at $ echo "$(npm root -g)" . When you import this util (package), use following ESM signature :

import { new$ } from 'typed-getters/src/index.mjs';

Please refer to ./src/tests/ running each test as node /src/tests/test_name.mjs | whereas "test_name" := instance | factor (you get the idea) ; each test example is ESM-friendly script that can be evaluated in both run-times : browser of choice and Node.js .

Source

Consider the following code excerpt of our node /src/tests/instance.mjs example as follows :

class Name$sruct {

    constructor(){
        // constructor implements typed-getters via its accessors (refer to ./src/index.mjs for TypedMap)
    }

}

class Name$interface extends Name$sruct {

    methodDeclaration(){
        // decoupled prototype for will-be instance of Name$sruct
    }

}

From the code above, we see that it only makes sense (decoupling) prototype from its related instance if we are duck-typing . Of course, we could achieve similar idea using Reflect.apply (refer to ./src/tests/factor.mjs), however in turn it would return factor rather than instance as our new$ named export essentialy is nothing else than a slighly modified Reflect.construct.


Happy coding ♥ projektorius96