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

quasi-

v1.0.1

Published

quasi-primitive creator

Downloads

8

Readme

quasi-

Installation

$ npm i quasi-

Bare Bones

const quasi = require('quasi-'); 
let message = quasi("Hello world!");
message.on("change", (newVal, oldVal) => console.log(oldVal, "changed to:", newVal));

//Variable Reassignment

message._ = "Yo wassup";
//Prints: "Hello world! changed to: Yo wassup"

//Function usage
console.log(message.slice(1));
//Prints: o wassup

Complexities

const quasi = require('quasi-');
let message = quasi("Hello World");

message.on('change', (newMessage, old) => console.log("Value changed to:", newMessage, "From:", old));

message._ = "Hello?";
// Prints: "Value Changed to: Hello? From: Hello World"

message.on('retrieve', (valRetrieved, primitiveValue, retrievalKey) => 
    console.log("Retrieved:", valRetrieved, primitiveValue, retrievalKey));

//Use ._ to work with value itself.
message._;
//Prints "Retrieved: Hello? Hello? _

message.on('slice', 
    (func, primitive, retrievalKey) => 
    console.log(`${func} was called on ${primitive}`));
console.log(message.slice(1));
=> ello World
//Prints function slice() { [native code] } was called on Hello?
//This is called whenever a function is retrieved from an object, but not
//when the function is called. Thus it can't access the arguments.
//message.slice would produce the same result.

//Example Usage
//On change with sockets
message.on('change', (newVal) => socket.emit(newVal));

//For testing
message.on('slice', () => throw new Error("Can't call slice within overwrite of slice"));

//For immutability
let array = quasi(["CONSTANT", "ANOTHER_CONSTANT"]);
array.on('change', () => {throw new Error('Immutable Array')});
console.log(array.push(3));
=> Error: Immutable Array

Overloading

const quasi = require('quasi-');

let funcObjCons = quasi({property: "some property"});
funcObjCons.on('call', () => console.log('Function was called'));
funcObjCons.on('new', function(arg) {return {newProp: "this was a new object called with" + arg}});
funcObjCons();
//Prints: Function was called

let test = new funcObjCons("quasi");
console.log(test);
//Prints: {newProp: "this was a new object called with quasi"};

console.log(funcObjCons.property);
//Prints: some property

License

MIT

Free Software, Hell Yeah!