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

@guilelab/tools

v1.7.0

Published

Biblioteca utilitária convertida para TypeScript

Readme

@guilelab/tools

A @guilelab/tools é uma biblioteca utilitária em TypeScript que reúne helpers para matemática, strings, arrays, objetos, números e estruturas de árvore. Ela mantém compatibilidade com o uso em CommonJS e também pode ser consumida em projetos TypeScript.

Instalação

npm install @guilelab/tools

Uso básico

TypeScript

import { GuileMath, GuileArray, GuileString, GuileObject, GuileNumber } from '@guilelab/tools';

console.log(GuileMath.choice('maçã', 'banana', 'uva'));
console.log(GuileArray.firstOrDefault([1, 2, 3], 0));
console.log(GuileString.chunk('abcdef', 2));
console.log(GuileObject.chain({ user: { profile: { name: 'Ana' } } }, 'user', 'profile', 'name'));
console.log(GuileNumber.toFormat(1022.534, { prefix: 'R$ ', precision: 2, thousandSeparator: '.', decimalSeparator: ',' }));

CommonJS

const { GuileMath, GuileArray } = require('@guilelab/tools');

console.log(GuileMath.choice('a', 'b', 'c'));
console.log(GuileArray.lastOrDefault([10, 20, 30], 0));

Possíveis usos

1. Trabalhar com arrays

import { GuileArray } from '@guilelab/tools';

const numbers = [1, 2, 3, 4, 5];

console.log(GuileArray.firstOrDefault(numbers, 0));
console.log(GuileArray.lastOrDefault(numbers, 0));
console.log(GuileArray.chunk(numbers, 2));

Você também pode injetar métodos diretamente no protótipo de Array:

GuileArray.injectToGlobalMethods();

console.log([1, 2, 3].firstOrDefault(0));
console.log([1, 2, 3].chunk(2));

2. Operar com strings

import { GuileString } from '@guilelab/tools';

console.log(GuileString.eq('Olá', 'Olá'));
console.log(GuileString.chunk('abcdef', 2));

3. Navegar objetos com encadeamento seguro

import { GuileObject } from '@guilelab/tools';

const data = { user: { profile: { name: 'Carlos' } } };

console.log(GuileObject.chain(data, 'user', 'profile', 'name'));
console.log(GuileObject.chain(data, 'user', 'profile', 'age'));

4. Trabalhar com números e formatação

import { GuileNumber } from '@guilelab/tools';

console.log(GuileNumber.gt(10, 5));
console.log(GuileNumber.gte(10, 10));
console.log(GuileNumber.lte(3, 5));
console.log(GuileNumber.intDiv(10, 3));
console.log(GuileNumber.toFormat(1250.5, { prefix: 'R$ ', precision: 2, thousandSeparator: '.', decimalSeparator: ',' }));
console.log(GuileNumber.brl(1250.5));
console.log(GuileNumber.usd(1250.5));
console.log(GuileNumber.eur(1250.5));

Também é possível extender o protótipo de Number:

GuileNumber.injectToGlobalMethods();

console.log((25).gt(20));
console.log((1000).brl());
console.log((1000).usd());
console.log((1000).eur());
console.log((1000).toFormat({ prefix: 'R$ ', precision: 2, thousandSeparator: '.', decimalSeparator: ',' }));

5. Escolher elementos aleatoriamente

import { GuileMath } from '@guilelab/tools';

const fruits = ['maçã', 'banana', 'uva'];
console.log(GuileMath.choice(...fruits));

6. Criar e manipular árvores de nós

import { GuileTreeNode } from '@guilelab/tools';

const tree = new GuileTreeNode({
  key: 'root',
  extras: { label: 'Raiz' },
  childrens: [
    { key: 'child-1', extras: { label: 'Filho 1' } },
    { key: 'child-2', extras: { label: 'Filho 2' } },
  ],
});

const withParents = GuileTreeNode.fillParent(tree);
const list = GuileTreeNode.treeToList(withParents);
console.log(list);

7. Trabalhar com números muito grandes em string

import { GuileGigaNumber } from '@guilelab/tools';

const a = '12345678901234567890'.repeat(2);
const b = '98765432109876543210'.repeat(2);

console.log(GuileGigaNumber.add(a, b));
console.log(GuileGigaNumber.multiply(a, '2'));
console.log(GuileGigaNumber.pow('10', '3'));

Build

npm install
npm run build