DEV Community

Cover image for JavaScript Reusable Constants that are used in most apps.
Youssef Zidan
Youssef Zidan

Posted on • Edited on

12 2

JavaScript Reusable Constants that are used in most apps.

Constants.js

Installation

npm i constants-js
Enter fullscreen mode Exit fullscreen mode

Usage

// ES6
import { languages } from "constants-js";

console.log(languages);
Enter fullscreen mode Exit fullscreen mode

Available Constants

Name Variable Name Type Example Output
Continents continents Array [{ africa: { label: "Africa", code: "AF" },... ]
Countries countries Array [{ name: "Afghanistan", dial_code: "+93", code: "AF" }, ...]
Duration duration Array [ { label: "day", value: 8.64e7 },... ]
Islamic Months islamicMonths Array [ { label_en: "al-Muharram", label_ar: "ٱلْمُحَرَّم", value: 0 },...]
Languages languages Array [{ code: "ab", name: "Abkhazian" }, ...]
Lower Case Characters lowerCases Array ["a", "b", "c",...]
Months months Array [{ label: "January", value: 0 }, ... ]
Numbers numbers Array ["0", "1", "2",...]
special Characters specialChars Array ['!', '"', '#',...]
Upper Case Characters upperCases Array ["a", "b", "c",...]
Week Days weekDays Array [{ label: "Sunday", value: 0 }, ... ]
Status status Object { continue: 100, switching_protocols: 101, processing: 102 }

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
miketalbot profile image
Mike Talbot ⭐

Useful, thanks!!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs