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

brutdecode

v1.0.1

Published

Brutdecode is common package for all BrutdeCom projects. Contain utils function and many more.

Downloads

4

Readme

BRUTDECODE PACKAGE DOCUMENTATION

Introduction

This package is npm package in TypeScript for BDC's project.

Update this package

  1. Run git clone https://github.com/BrutdeCom/brutdecode.git
  2. Create branch for your additions, and go to your local branch
  3. Run npm i
  4. Make your code with love. Tested code is better.
  5. Code is finished ? Run git add ., then git commit -m '[your atomic commit]'
  6. Run npm run release. Launch tests, and update package version. Is obligatory for the rest.
  7. Run git push origin [your branch]
  8. Create your pull request to production branch. If actions passed, validate your PR.
  9. It's good, package is automatically published.
  10. In your project, update brutdecode to use your new features.

Installation

For install this package, run npm i brutdecode

Use

Example for require function :

import { checkId, createEnum } from 'brutdecode'

Regex

Example for use Regex with this package :

// Require the regex you need
import { URL_REGEX } from 'brutdecode'

// Here use URL_REGEX

| Regex Type | Description | Name | | :------------ | :-------------: | :-------------: | | password | 8 characters, 1 lowercase, 1 uppercase, 1 special character, 1 number | PASSWORD_REGEX | | phone | Phone and fax number | PHONE_REGEX | | city | City (2 characters minimum, not number) | CITY_REGEX | | zip | French zip code (5 numbers) | ZIP_REGEX | | email | Email format | EMAIL_REGEX | | url | URL format | URL_REGEX |

Validator

Validator part is utils for validate various data. Example for use Validator with this package :

import { isValidString } from 'brutdecode'

// Use isValidString for example
const myConst = isValidString('string')
// return true

const myConst = isValidString(14)
// return false

| Name | Description | Parameters | return | | :------------ | :-------------: | :-------------: | :-------------: | | isValidString('string') | Verify if value is valid string | String parameters ('one string') | Return true or false | | isValidEmail('[email protected]') | Verify if email is valid format | String parameters ('[email protected]') | Return true or false | | isValidZip('40500') | Verify if value is valid zip code format for France. | String parameters ('40530') | Return true or false | | isValidCountry('France') | Verify if value is valid country format. | String parameters ('France') | Return true or false | | isValidAddress('3 rue de la Liberté') | Verify if value is valid address format. | String parameters ('3 rue de la Liberté') | Return true or false | | isValidCity('Biarritz') | Verify if value is valid city format. | String parameters ('Biarritz') | Return true or false | | isValidPhone('0625458769') | Verify if value is valid phone and fax number format. | String parameters ('0625458769') | Return true or false | | isValidLastname('Lastname') | Verify if value is valid lastname format. | String parameters ('Lastname') | Return true or false | | isValidFirstname('Firstname') | Verify if value is valid Firstname format. | String parameters ('Firstname') | Return true or false | | isValidPassword('password') | Verify if value is valid password format (8 characters, 1 lowercase, 1 uppercase, 1 special character, 1 number). | String parameters ('password') | Return true or false | | isValidSiret('string') | Verify if value is valid siret | String siret parameters ('12345678998765') | Return true or false | | isValidEnum('string', array) | Verify if value is valid enumeration | String value parameters ('test'), array parameters (Enum.MyEnum) | Return true or false |

Utils

Example for use Utils with this package :

import { checkId } from 'brutdecode'

// Use utils function
const myConst = checkId(myId)
// return ...
const verifyIfRequestItemsIsString = validateStringRequestItems({
        value1: 'test1',
        value2: 'test2',
        value3: 12
})
// return false, because one value is not a string

  const verifyIfRequestItemsIsString = validateStringRequestItems({
        value1: 'test1',
        value2: 'test2'
})
// return true, because all values is string

Enumerations

Create Enum

import { createEnum } from 'brutdecode'

const CarBrand = {
  RENAULT: 'renault', 
  PEUGEOT_CITROEN: 'peugeot-citroen', 
  FORD: 'ford'
}

export const CarBrandEnum = createEnum(CarBrand, 'CarBrand')

Methods

CarBrand.getValues() // return ['renault', 'peugeot-citroen', 'ford']
CarBrand.next() // return 'renault'
CarBrand.next('renault') // return 'peugeot-citroen'
CarBrand.next('ford') // return 'renault'
CarBrand.isValid('renault') // return true
CarBrand.isValid('test') // return false
// Update CarBrand with categories for example
const CarBrand = {
  frenchBrand: {
    RENAULT: 'renault', 
    PEUGEOT_CITROEN: 'peugeot-citroen', 
  },
  americanBrand: {
    FORD: 'ford'
  }
}

CarBrand.getCategories() // return ['frenchBrand', 'americanBrand']
// Update CarBrand with categories for example
const CarBrand = {
  frenchBrand: {
    RENAULT: 'renault', 
    PEUGEOT_CITROEN: 'peugeot-citroen', 
  },
  americanBrand: {
    FORD: 'ford'
  }
}

CarBrand.getCategory('frenchBrand') // return ['renault', 'peugeot-citroen']
CarBrand.getIndex('renault') // return 0
CarBrand.getIndex('RENAULT') // return 0
// Update CarBrand with categories for example
const CarBrand = {
    RENAULT: 'renault', 
    PEUGEOT_CITROEN: 'peugeot-citroen',
    FORD: {
      value: 'ford',
      engine: '1.2',
      test: false
    }
  }

CarBrand.getMetaData(CarBrand.FORD, 'engine') // return '1.2'
CarBrand.getMetaData(CarBrand.FORD, 'test') // return false