Git Product home page Git Product logo

farhanaliofficial / farhanjs Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 33 KB

The FarhanJS JavaScript Library is a versatile utility library that provides various string and data manipulation functions. It simplifies tasks like binary and hexadecimal conversion, base64 encoding/decoding, URL encoding/decoding, and random value generation. This library is designed to be easy to use and understand.

License: MIT License

JavaScript 100.00%

farhanjs's Introduction

FarhanJS JavaScript Library v1.0.0

Created on: 16/09/2023 03:33 PM in Pakistan Written by: Farhan Ali (16 years old)

Description

The Farhan JavaScript Library is a versatile utility library that provides various string and data manipulation functions. It simplifies tasks like binary and hexadecimal conversion, base64 encoding/decoding, URL encoding/decoding, and random value generation. This library is designed to be easy to use and understand.

Usage

To use this library in your project, you can include it via a CDN like jsDelivr. Simply add the following script tag to your HTML file:

<script src="https://cdn.jsdelivr.net/gh/farhanaliofficial/farhanjs@main/farhan.js"></script>

License

This library is released under the MIT License. See the LICENSE file for details.

Contributions

Contributions and feedback are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

Class Structure

The library includes the following class:

Farhan

  • ord(c): Get the Unicode code point of a character.
  • chr(v): Get the character from a Unicode code point.
  • bin(b, p=8): Convert a number to binary with optional padding.
  • hex(a): Convert a number to hexadecimal.
  • str2bin(text): Convert a string to a binary representation.
  • bin2str(text): Convert a binary string to its original string.
  • str2hex(text): Convert a string to a hexadecimal representation.
  • hex2str(text): Convert a hexadecimal string to its original string.
  • base64encode(text): Encode a string to Base64.
  • base64decode(text): Decode a Base64 string to its original string.
  • urlsafe_b64encode(text): Encode a string to URL-safe Base64.
  • urlsafe_b64decode(text): Decode a URL-safe Base64 string.
  • urlencode(url): URL-encode a string.
  • urldecode(url): URL-decode a string.
  • random_int(min, max): Generate a random integer within a specified range.
  • random_char(min, max): Generate a random character within a specified range.
  • random_choice(array): Choose a random element from an array or string.
  • random_hexstr(len=20): Generate a random hexadecimal string of a specified length.
  • validateDW(): Validate the presence of the document and window objects (for use with copy method).
  • copy(textE): Copy text to the clipboard (requires document and window objects).
  • _(q): Select an element using a query selector (requires document and window objects).

Error Handling

The library includes a custom error class FarhanError to handle exceptions.

class FarhanError extends Error {
	constructor(msg) {
		super(msg);
		this.name = "FarhanError";
	}
}

Feel free to explore and utilize the FarhanJS JavaScript Library for your projects!

farhanjs's People

Contributors

farhanaliofficial avatar

Watchers

 avatar

Forkers

rajv33r009

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.