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 🙏

© 2025 – Pkg Stats / Ryan Hefner

goggledy

v0.2.0

Published

Library to parse and generate Goggles.

Readme

Goggledy is a TypeScript library that lets you easily interact with Brave Search Goggles.

It can be used to parse Goggle code into a JavaScript representation, or to generate goggle code from a Goggle object.

This opens the door for applications that want to interact with Goggles in a more programmatic way. E.g. interactive editors, code generators, etc.

Parsing Goggles

Parsing a goggle into a structured JavaScript representation holding all the information about the Goggle with Goggle.parse():

import { Goggle } from 'goggledy'

const goggle = Goggle.parse(
  `! name: Some name
   ! description: Some description`,
)

console.log(goggle.metaData.name) // Some name

Generating Goggles

Generating Goggles from JavaScript representation with Goggle.toString():

import * as goggledy from 'goggledy'

const goggle = new goggledy.Goggle(
  // Goggle lines, e.g. instructions, comments, etc.
  [
    new goggledy.GoggleEmpty(),
    new goggledy.GoggleComment('Some comment'),
    new goggledy.GoggleInstruction('pattern', {
      site: 'example.org',
      discard: true,
    }),
  ],
  // Goggle meta data
  {
    name: 'Some name',
    description: 'Some description',
    // This is a shorthand for:
    // `goggledy.GoggleMeta('name', 'Some name')`
    // under the lines array above.
  },
)

console.log(goggle.toString())
// ! name: Some name
// ...

Comparison

See how to construct a Goggle in Goggledy and what values it returns with its toString() method, and when it is passed to JSON.stringify().

! name: Some name
! description: Some description
! public: true
new Goggle([], {
  name: 'Some name',
  description: 'Some description',
  public: true,
})
{
  "metaData": {
    "name": "Some name",
    "description": "Some description",
    "public": true
  },
  "lines": [
    {
      "type": "meta",
      "key": "name",
      "value": "Some name"
    },
    {
      "type": "meta",
      "key": "description",
      "value": "Some description"
    },
    {
      "type": "meta",
      "key": "public",
      "value": true
    }
  ]
}
pattern$boost=10,incontent,site=example.org
new GoggleInstruction('pattern', {
  boost: 10,
  incontent: true,
  site: 'example.org',
})
{
  "type": "instruction",
  "pattern": "pattern",
  "options": {
    "boost": 10,
    "incontent": true,
    "site": "example.org"
  }
}
! name: value
new GoggleMeta('name', 'value')
{
  "type": "meta",
  "key": "name",
  "value": "value"
}
! comment
new GoggleComment(' comment')
{
  "type": "comment",
  "value": " comment"
}
new GoggleEmpty()
{
  "type": "empty"
}

Who uses Goggledy?

  • Gearchy uses Goggledy for two matters, parsing Goggles stored in GitHub gists to populate its interactive Goggle editor, and generating Goggles from the editor to store them back in GitHub gists.