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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nightcycle/option

v1.0.1

Published

A basic port of the rust Option class

Readme

option

A safer alternative to null.

usage

It's a pretty lightweight package.

construction

You can create a new option via a few methods

-- none() creates the option as none
local character: Option<Model> = Option.none()

-- from() accepts a possibly null value, creating as some if not null
character = Option.from(player.Character)

-- some() will error if it receives a null value, but always creates the option as some
character = if player.Character then Option.some(player.Character) else Option.none()

-- try runs a function to get the value (use from if state is static)
character = Option.try(function(): Character?
    return player.Character
end)

helper functions

The package interface has a few handy methods.

-- map() is also a class method, but this allows for type changing
local name: Option<string> = Option.map(character, function(char: Model)
    return char.Name
end)

-- isOption() checks if an unknown value is an option
assert(Option.isOption(name), `name is not an option`)

-- supports `osyrisrblx/t` standard runtime type refinement
local isAModelOption = Option.type(t.instanceIsA("Model"))
local success, message = isAModelOption(name) -- I know, `message = string?`, it's the standard - we can't dump null overnight

methods

For checking the state of the option:

if name:isSome() then
    print("name is some!")
end

if name:isNone() then
    print("name is none!")
end

-- only runs when some, otherwise it's passed over
name:inspect(function(str)
    print(`name is "{str}"!`)
end)

For extracting the state of the option:


-- if the option is none, the thread panics
local nameStr = name:unwrap()
nameStr = name:expect(`name is none()`) -- same as unwrap, but custom error message

-- both functions need to return the same type, used for flattening the option
nameStr = name:match(function(some)
    return name
end, function()
    return "Default Name"
end)

-- if you don't need to process the some() value, unwrapOr is a handy alternative
nameStr = name:unwrapOr("Default Name")

-- only calls the function if there's a none value - good for performance if getting the value is process heavy
nameStr = name:unwrapOrElse(function()
    return "Default Name"
end)

local maybeNameStr: string? = name:asNullable() -- most of the ecosystem uses null values, it's silly to pretend otherwise

-- constructs a new option with the return value of the callback
local lowerCaseName: Option<string> = name:map(function(some)
    return some:lower()
end)

bloxidize

If you like this, check out my suite of rust inspired packages: bloxidize