DEV Community 👩‍💻👨‍💻

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

Posted on • Updated on

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 }

Top comments (1)

Collapse
 
miketalbot profile image
Mike Talbot

Useful, thanks!!

Classic DEV Post:

caching

Web Caching Explained by Buying Milk at the Supermarket