GithubHelp home page GithubHelp logo

masker's Introduction

Masker Library

Overview

The Masker Library is a simple Python-based library designed to mask characters in a given word. It provides flexibility to mask characters from the start, end, or middle of the word while keeping a specified number of characters unmasked.

Features

  • Mask characters from the start: Mask all characters except for a specified number at the end.
  • Mask characters from the end: Mask all characters except for a specified number at the start.
  • Mask characters from the middle: Mask characters in the middle while keeping specified numbers of characters at both the start and the end.

Installation

You can install the Masker library using pip:

pip install masker

Usage

Import the Library

from masker import Masker

Initialize the Masker

Create an instance of the Masker class with an optional mask character (default is '*').

masker = Masker(mask_char='#')

Masking Examples

Mask from Start

Mask all characters except the specified number of characters at the end.

masked_word = masker.start("exampleword", keep_char=4)
print(masked_word)  # Output: "######word"

Mask from End

Mask all characters except the specified number of characters at the start.

masked_word = masker.end("exampleword", keep_char=3)
print(masked_word)  # Output: "exa########"

Mask from Middle

Mask characters in the middle while keeping specified numbers of characters at both the start and the end.

masked_word = masker.mid("exampleword", start_keep_char=2, end_keep_char=3)
print(masked_word)  # Output: "ex#######ord"

Methods

start(word, keep_char=0)

Returns the word with the specified number of characters masked from the start.

  • Parameters:
    • word (str): The input word to be masked.
    • keep_char (int): Number of characters to keep unmasked from the start.
  • Returns: (str) The masked word.

end(word, keep_char=0)

Returns the word with the specified number of characters masked from the end.

  • Parameters:
    • word (str): The input word to be masked.
    • keep_char (int): Number of characters to keep unmasked from the end.
  • Returns: (str) The masked word.

mid(word, start_keep_char=0, end_keep_char=0)

Returns the word with the specified number of characters masked from the start and end.

  • Parameters:
    • word (str): The input word to be masked.
    • start_keep_char (int): Number of characters to keep unmasked from the start.
    • end_keep_char (int): Number of characters to keep unmasked from the end.
  • Returns: (str) The masked word.

License

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

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss changes.


Happy masking!

masker's People

Contributors

burhankd avatar kankburhan avatar

Watchers

 avatar

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.