All Projects β†’ BolajiOlajide β†’ utils

BolajiOlajide / utils

Licence: other
javascript library of helper functions I use

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to utils

utils.js
πŸ‘· πŸ”§ zero dependencies vanilla JavaScript utils.
Stars: ✭ 14 (+7.69%)
Mutual labels:  utils
silky-charts
A silky smooth D3/React library
Stars: ✭ 38 (+192.31%)
Mutual labels:  utils
urley
πŸ“¦ An easy cross-platform utility library to work with URLs in Javascript.
Stars: ✭ 14 (+7.69%)
Mutual labels:  utils
clearbit-go
Go bindings for Clearbit
Stars: ✭ 12 (-7.69%)
Mutual labels:  utils
purescript-ffi-utils
A utility library for the purescript foreign function interface
Stars: ✭ 22 (+69.23%)
Mutual labels:  utils
core
πŸ”₯ Antares Core Implemenation. Most important project layer, this is the heart for your app. ACL, notifiter, console, geoip, areas, utils and many more...
Stars: ✭ 24 (+84.62%)
Mutual labels:  utils
onex-utils
Web business development general tool library ι€šη”¨δΈšεŠ‘ε·₯ε…·εΊ“ πŸ₯·
Stars: ✭ 23 (+76.92%)
Mutual labels:  utils
go-tools
A utility tool library of Golang.
Stars: ✭ 44 (+238.46%)
Mutual labels:  utils
dotty dict
Dictionary wrapper for quick access to deeply nested keys.
Stars: ✭ 67 (+415.38%)
Mutual labels:  utils
at tools
Source repo for at_commons and at_utils on pub.dev
Stars: ✭ 22 (+69.23%)
Mutual labels:  utils
tdesign-common
TDesign style/utils shared by multiple frameworks repo.
Stars: ✭ 70 (+438.46%)
Mutual labels:  utils
sagittarius
🎯 A set of javascript most used utilsπŸ“‘
Stars: ✭ 42 (+223.08%)
Mutual labels:  utils
toxic-decorators
Library of Javascript decorators
Stars: ✭ 26 (+100%)
Mutual labels:  utils
Log
Breaking android log word limits and automatically formatting json.
Stars: ✭ 14 (+7.69%)
Mutual labels:  utils
bigger
bigg (bgfx + imgui + glfw + glm) + utils
Stars: ✭ 101 (+676.92%)
Mutual labels:  utils
markdown-utils
Convert plain text into snippets of markdown.
Stars: ✭ 28 (+115.38%)
Mutual labels:  utils
util-ts
Utils for mobile browsers, built with TypeScript
Stars: ✭ 23 (+76.92%)
Mutual labels:  utils
portuguese-utils
A set of useful utils for developing portuguese apps
Stars: ✭ 20 (+53.85%)
Mutual labels:  utils
Smart-Inspector
Fluent re-take on Unity Inspector UX. Packed with QoL improvements.
Stars: ✭ 680 (+5130.77%)
Mutual labels:  utils
django-etc
Tiny stuff for Django that won't fit into separate apps.
Stars: ✭ 26 (+100%)
Mutual labels:  utils

@bolajiolajide/utils

alfred avatar

Collection of utility functions/helpers I use in my everyday development.

Methods

capitalize This method is used to capitalize a string.
  • value string to be capitalize
const { capitalize } = require('@bolajiolajide/utils');

const data = capitalize('bolaji');
console.log(data);
// 'Bolaji'
convertSliceToString This method is used to convert a string slice into a string.
  • value string slice to convert
  • separator string to use to separate the different items in the slice
const { convertSliceToString } = require('@bolajiolajide/utils');

const data = convertSliceToString('bolaji');
console.log(data);
// 'bolaji'

const data2 = convertSliceToString(['bol', 'aji']);
console.log(data2);
// 'bolaji'

const data3 = convertSliceToString(['bol', 'aji', 'pro', 'ton'], '**');
console.log(data3);
// 'bol**aji**pro**ton'
countries This is a list of countries all over the world. It's a pretty long list.
const { countries } = require('@bolajiolajide/utils');

console.log(countries);
// ['Afghanistan', ...]
delay This method is used to add a delay to an async method. It takes in one argument which is the amount of milliseconds to delay.
const { delay } = require('@bolajiolajide/utils');

await delay(10000); // delay for 10seconds
generateCSV This method is used to generate a csv string from an array of objects. It takes in array of objects with a key-value type of string. The output is a string which will be the records in the array delimited by a comma.
const { generateCSV } = require('@bolajiolajide/utils');

const data = [
  { name: 'John Doe', age: 20 },
  { name: 'Jane Doe', age: 23 }
];
const csv = generateCSV(data);
console.log(csv);
// name, age
// John Doe, 20
// Jane Doe, 23
generateShortCode This method is used to generate a not so unique shortcode. The default shortcode length is 5.
const { generateShortCode } = require('@bolajiolajide/utils');

const shortcode = generateShortCode(10);
console.log(shortcode);
// 637010000
isDict This method returns a boolean depending on whether the argument supplied is a dictionary.
  • value literal to check type
const { isDict } = require('@bolajiolajide/utils');

const data = isDict('bolaji');
console.log(data);
// false

const data2 = isDict({ amount: 230329 });
console.log(data2);
// true
isString This method returns a boolean depending on whether the argument supplied is a string.
  • value literal to check type
const { isString } = require('@bolajiolajide/utils');

const data = isString('bolaji');
console.log(data);
// true

const data2 = isString(230329);
console.log(data2);
// false
runOnce This method is used to set a function to run only once. It's argumument is:
  • fn the function to be run only once
const { runOnce } = require('@bolajiolajide/utils');

const addTogether = function(num1:number, num2:number):number{
  return num1+num2
}
const addTogetherOnce = runOnce(addTogether)
let firstResult = addTogetherOnce(0,1)
let secondResult = addTogetherOnce(0,1)
console.log(firstResult)
console.log(secondResult)
});
// firstResult:  1
// secondResult: undefined
paginate This method is used to lazily paginate an array of items. It can be used for client-side pagination where no server exists. It's argumumets are:
  • limit how many items to receive per page
  • page page number to be retrieved
  • data the array of data to be paginated
const { paginate } = require('@bolajiolajide/utils');

const data = paginate(2, 2, [
  'Jane',
  'John',
  'James',
  'Bill',
  'Steve',
  'Melissa',
  'Esther',
  'Shannon'
]);
console.log(data);
// ['James', 'Bill']
sentencize This method is used to capitalize several words in a phrase depending on the separator. It's argumumets are:
  • word the word/phrase to sentencize
  • separator a string separating the words in a phrase, defaults to ' '
const { sentencize } = require('@bolajiolajide/utils');

const data = sentencize('APPLE_MUSIC', '_');
console.log(data);
// 'Apple Music'

const data = sentencize('SPOTIFY');
console.log(data);
// 'Spotify'
isUrl This method is used to check if a string is a valid URL
  • url the url to be checked
const { isUrl } = require('@bolajiolajide/utils');

const response = isUrl('APPLE_MUSIC');
console.log(response);
// false

const response = isUrl('https://google.com');
console.log(response);
// true
isHttpUrl This method is used to check if a string is a valid http URL
  • url the url to be checked
const { isHttpUrl } = require('@bolajiolajide/utils');

const response = isHttpUrl('ftp://dskjdslds');
console.log(response);
// false

const response = isUrl('https://google.com');
console.log(response);
// true
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].