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

@dinush/srilankan-universities-faculties-degrees

v2.0.0

Published

Library to fetch all Sri Lankan Universities, Faculties and their Degree programmes

Readme

Table of Contents

Installation

via npm

npm i @dinush/[email protected]

Usage

JavaScript (CommonJS)

// Import everything from the package
const { getUniversities, getFaculties, getDegrees } = require("@dinush/srilankan-universities-faculties-degrees");

// Get all universities
const allUniversities = getUniversities();
// ["University of Colombo", "University of Peradeniya", ...]

// Get faculties of a selected university
const colomboFaculties = getFaculties("University of Colombo");
// ["Faculty of Arts", "Faculty of Education", "Faculty of Law", ...]

// Get degrees of a selected faculty at a university
const lawDegrees = getDegrees("University of Colombo", "Faculty of Law");
// ["Bachelor of Laws"]

// Access legacy data structure
const { universities_data } = require("@dinush/srilankan-universities-faculties-degrees");
const rawData = universities_data["University of Colombo"]["Faculty of Law"];
// ["Bachelor of Laws"]

TypeScript / ES Modules

// Import the modern API
import {
  getAllUniversities,
  getFacultiesByUniversity,
  getDegreesByFaculty,
  getUniversity,
  getFaculty,
  validateUniversity,
  validateFaculty,
  University,
  Faculty,
  Degree
} from "@dinush/srilankan-universities-faculties-degrees";

// Get all universities with detailed data
const universities: University[] = getAllUniversities();
/*
[
  { id: "university-of-colombo", name: "University of Colombo", code: "UOC" },
  { id: "university-of-peradeniya", name: "University of Peradeniya", code: "UOP" },
  ...
]
*/

// Get specific university by name or ID (case-insensitive)
const colombo: University | undefined = getUniversity("University of Colombo");
const colomboById: University | undefined = getUniversity("university-of-colombo");

// Validate university existence
const isValid: boolean = validateUniversity("University of Colombo"); // true

// Get faculties of a university with detailed data
const faculties: Faculty[] = getFacultiesByUniversity("University of Colombo");
/*
[
  { id: "faculty-of-law-colombo", universityId: "university-of-colombo", name: "Faculty of Law" },
  { id: "faculty-of-science-colombo", universityId: "university-of-colombo", name: "Faculty of Science" },
  ...
]
*/

// Get specific faculty
const lawFaculty: Faculty | undefined = getFaculty("University of Colombo", "Faculty of Law");

// Validate faculty in university
const facultyExists: boolean = validateFaculty("University of Colombo", "Faculty of Law"); // true

// Get degrees offered by a faculty
const degrees: Degree[] = getDegreesByFaculty("University of Colombo", "Faculty of Law");
/*
[
  {
    id: "bachelor-of-laws-colombo",
    universityId: "university-of-colombo",
    facultyId: "faculty-of-law-colombo",
    name: "Bachelor of Laws"
  }
]
*/

// Get all data
const allUniversities: University[] = getAllUniversities();
const allFaculties: Faculty[] = getAllFaculties();
const allDegrees: Degree[] = getAllDegrees();

Individual Module Imports (TypeScript / ES Modules)

// Import only the universities module
import { getAllUniversities, getUniversity, validateUniversity } from "@dinush/srilankan-universities-faculties-degrees/universities";

// Import only the faculties module
import { getAllFaculties, getFacultiesByUniversity, getFaculty, validateFaculty } from "@dinush/srilankan-universities-faculties-degrees/faculties";

// Import only the degrees module
import { getAllDegrees, getDegreesByFaculty } from "@dinush/srilankan-universities-faculties-degrees/degrees";

// Import legacy compatibility
import { getUniversities, getFaculties, getDegrees } from "@dinush/srilankan-universities-faculties-degrees/compatibility";

API Reference

Modern API (New in v2.0)

Universities

  • getAllUniversities(): Returns all universities with detailed data
  • getUniversity(nameOrId): Returns a specific university by name or ID (case-insensitive)
  • validateUniversity(nameOrId): Validates if a university exists

Faculties

  • getAllFaculties(): Returns all faculties with detailed data
  • getFacultiesByUniversity(universityNameOrId): Returns faculties for a specific university
  • getFaculty(universityNameOrId, facultyNameOrId): Returns a specific faculty
  • validateFaculty(universityNameOrId, facultyNameOrId): Validates if a faculty exists in a university

Degrees

  • getAllDegrees(): Returns all degree programs with detailed data
  • getDegreesByFaculty(universityNameOrId, facultyNameOrId): Returns degrees offered by a specific faculty

Legacy API (v1.x Compatibility)

These functions are maintained for backward compatibility:

  • getUniversities(): Returns array of university names
  • getFaculties(university): Returns array of faculty names
  • getDegrees(university, faculty): Returns array of degree names
  • universities_data: Legacy data structure for direct access

Framework Examples

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Author