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

broonks.db

v1.1.2

Published

Um simples banco de dados em JSON com o foco em performance e simplicidade.

Downloads

24

Readme

Broonks Database

Um simples banco de dados em JSON com o foco em performance e simplicidade.

Inspirado no quick.db e no Enmap.


Instalação

Instale a database com npm install broonks.db


Exemplo básico

const DatabaseManager = require('broonks.db')

//Essa será a varíavel que você usará para manipular a Database.
const Database = new DatabaseManager()

//Define a chave 'pessoas bonitas' para uma lista com pb7 e broonks
Database.set('pessoas bonitas', ['pb7', 'broonks'])

//Adiciona o valor Toledo a chave 'pessoas bonitas' (apenas arrays/listas)
Database.push('pessoas bonitas', 'Toledo')

//Define a chave 'pessoas bonitas' para google.com
Database.set('website', 'google.com')

//Retorna o valor contido na chave website
Database.get('website')

//Excluí a chave website
Database.delete('website')

Documentação

Interrogação (?) signfica que uma opção é opcional e já possui um valor atribuído por padrão.

Opções sem interrogação retornarão um erro dizendo que uma opção está faltando em tal metódo.

  • Database#set(chave, valor) | Cria ou altera uma chave com o valor específico

    Database.set('melhor bot', 'broonks')
    • Tipos:
      • Chave: string, number
      • Valor: any (*)
      • Resultado: undefined
  • Database#get(chave) | Retorna o valor da chave

    Database.get('melhor bot')
    • Tipos:
      • Chave: string | number
      • Resultado: undefined | any (*)
  • Database#delete(chave) | Exclui uma chave

    Database.delete('moedas')
    • Tipos:
      • Chave: string | number

      • Resultado: undefined

  • Database#exists(chave) | Verifica se uma chave existe

    Database.exists('moedas')
    • Tipos:
      • Chave: string | number
      • Resultado: boolean
  • Database#add(chave, quantia) | Adiciona um número para a chave (adição)

    Database.add('dinheiro', 1200)
    • Tipos:
      • Chave: string | number
      • Quantia: number
      • Resultado: undefined
  • Database#remove(chave, quantia) | Remove um número para a chave (subtração)

    Database.remove('dinheiro', 1200)
    • Tipos:
      • Chave: string | number
      • Quantia: number
      • Resultado: undefined
  • Database#push(chave, item) | Adiciona um item a uma array

    Database.push('amigos', 'Jookie')
    • Tipos:
      • Chave: string | number

      • Item: any

      • Resultado: undefined

  • Database#pull(chave, item) | Remove um item de uma array

    Database.pull('amigos', 'Darkness')
    • Tipos:
      • Chave: string | number
      • Item: any
      • Resultado: undefined
  • Database#includes(chave, item) | Verifica se uma array possui um item específico

    Database.includes('amigos', 'MrPowerGamerBR')
    • Tipos:
      • Chave: string | number
      • Item: any
      • Resultado: boolean
  • Database#ping | Informa o tempo em miliseggundos para escrever e remover um item

    Database.ping
    • Tipos:
      • Resultado: number
  • Database#deleteAll() | Apaga todos os itens do banco de dados

    Database.deleteAll()
    • Tipos:
      • Resultado: undefined
  • Database#storage | Retorna o objeto da database

    Database.storage
    • Tipos:
      • Resultado: object
  • Database#all(tipo?) | Retorna todos os itens da database

    Database.all('all') //Retorna todas as entradas da database
    Database.all('keys') //Retorna todas as chaves da database
    Database.all('values') //Retorna todas os valores da database
    • Tipos:
      • Resultado: object