Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 12, 2021 04:06 am GMT

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 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: 9sim.len(users); // number: 2sim.capitalize(user); // string: Sebastiansim.upper(user); // string: SEBASTIANsim.lower(user); // string: sebastiansim.startswith(user, "s"); // boolean: truesim.startswith(user, "S"); // boolean: falsesim.endswith(user, "n"); // boolean: truesim.split(user, [0]); // string: ssim.split(user, [0, 2]); // string: sesim.split(user, [3, 0]); // string: astiansim.split(user, [0, -3]); // string: ianlet james_bond = 7;sim.zfill(james_bond, 2); // string: 007sim.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!


Original Link: https://dev.to/skorotkiewicz/new-npm-package-that-may-help-you-with-javascript-p5

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To