New npm package that may help you with JavaScript

Welcome dev community!

Today I would like to introduce you to my npm package, which can be useful for any beginner or advanced JavaScript developer.

It’s a collection of functions inspired from Python and rewritten for JavaScript, so now you can easi…


This content originally appeared on DEV Community and was authored by Sebastian Korotkiewicz

Welcome dev community!

Today I would like to introduce you to my npm package, which can be useful for any beginner or advanced JavaScript developer.

It's a collection of functions inspired from Python and rewritten for JavaScript, so now you can easily e.g. capitalize a string or display e.g. last 4 characters from a string.

To check it out, just install it quickly and easily via npm

$ npm install simhok
# or
$ yarn add simhok

Now all we have to do is import the package into JS project

const SimHok = require("simhok");
const sim = new SimHok();

Examples of usage with the result

const user = "sebastian";
const users = ["sebastian", "klaudia"];

sim.len(user); // number: 9
sim.len(users); // number: 2
sim.capitalize(user); // string: Sebastian
sim.upper(user); // string: SEBASTIAN
sim.lower(user); // string: sebastian

sim.startswith(user, "s"); // boolean: true
sim.startswith(user, "S"); // boolean: false
sim.endswith(user, "n"); // boolean: true

sim.split(user, [0]); // string: s
sim.split(user, [0, 2]); // string: se
sim.split(user, [3, 0]); // string: astian
sim.split(user, [0, -3]); // string: ian

let james_bond = 7;
sim.zfill(james_bond, 2); // string: 007

sim.log("test"); // "test")

GitHub logo skorotkiewicz / SimHok

A lightweight and easy-to-use library for features you probably use every day

I invite you to test and write a few opinions what you think about the package.
I will gladly accept PR!


This content originally appeared on DEV Community and was authored by Sebastian Korotkiewicz


Print Share Comment Cite Upload Translate Updates
APA

Sebastian Korotkiewicz | Sciencx (2021-07-12T04:06:38+00:00) New npm package that may help you with JavaScript. Retrieved from https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/

MLA
" » New npm package that may help you with JavaScript." Sebastian Korotkiewicz | Sciencx - Monday July 12, 2021, https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/
HARVARD
Sebastian Korotkiewicz | Sciencx Monday July 12, 2021 » New npm package that may help you with JavaScript., viewed ,<https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/>
VANCOUVER
Sebastian Korotkiewicz | Sciencx - » New npm package that may help you with JavaScript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/
CHICAGO
" » New npm package that may help you with JavaScript." Sebastian Korotkiewicz | Sciencx - Accessed . https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/
IEEE
" » New npm package that may help you with JavaScript." Sebastian Korotkiewicz | Sciencx [Online]. Available: https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/. [Accessed: ]
rf:citation
» New npm package that may help you with JavaScript | Sebastian Korotkiewicz | Sciencx | https://www.scien.cx/2021/07/12/new-npm-package-that-may-help-you-with-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.