This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

shrtct
TypeScript icon, indicating that this package has built-in type declarations

0.5.3 • Public • Published

A really small js library for shortcutting default js methods and values

NPM package version NPM package size Prettier code style Dependencies status

The purpose of this library is to reduce the size of the code without losing readability.

Shortcuts

Shortcuts for console

Here are some shorter versions of console methods

console.log > print()
console.error > error()
console.trace > trace()
console.assert > assert()

let { print, error, trace, assert } = require("./shrtct");

print("Hello world");
error("Some error");
trace("some stack trace");
assert(false, "some assertion");

Shortcuts for Math

Math constants

Math.PI > PI
Number.EPSILON > EPS
Math.E > E
Math.LN10 > LN10
Math.LN2 > LN2
Math.LN2 > LN2

let {
	EPS,
	E,
	LN10,
	LN2,
	LOG2E,
	LOG10E,
	PI,
	SQRT1_2,
	SQRT2,
} = require("./shrtct");

print(PI); // 3.141592653589793
print(EPS); // 2.220446049250313e-16
print(E); // 2.718281828459045
print(LN10); // 2.302585092994046
print(LN2); // 0.6931471805599453
print(LOG2E); // 1.4426950408889634
print(LOG10E); // 0.4342944819032518
print(SQRT1_2); // 0.7071067811865476
print(SQRT2); // 1.4142135623730951

Math methods

And also some shortcuts for Math methods

Math.abs() > abs()
Math.acos() > acos()
Math.asin() > asin()
Math.atan() > atan()
Math.atan2() > atan2()
Math.ceil() > ceil()
Math.cos() > cos()
Math.exp() > exp()
Math.floor() > floor()
Math.log() > log()
Math.log10() > log10()
Math.log2() > log2()
Math.log1p() > log1p()
Math.max() > max()
Math.min() > min()
Math.pow() > pow()
Math.random() > random()
Math.round() > round()
Math.sin() > sin()
Math.sqrt() > sqrt()
Math.tan() > tan()

let {
	abs,
	acos,
	asin,
	atan,
	atan2,
	ceil,
	cos,
	exp,
	floor,
	log,
	log10,
	log2,
	log1p,
	max,
	min,
	pow,
	random,
	round,
	sin,
	sqrt,
	tan,
} = require("./shrtct");

print(abs(-548)); // 548
print(acos(1)); // 2.718281828459045
print(asin(1)); // 2.302585092994046
print(atan(PI)); // 1.2626272556789115
print(atan2(1, 1)); // 0.7853981633974483
print(ceil(PI)); // 4
print(cos(PI)); // -1
print(exp(PI)); // 23.140692632779267
print(floor(PI)); // 3
print(log(PI)); // 1.1447298858494002
print(log10(PI)); // 0.4971498726941338
print(log2(PI)); // 1.6514961294723187
print(log1p(PI)); // 1.4210804127942926
print(max(PI, 0)); // 3.141592653589793
print(min(PI, 0)); // 0
print(pow(PI, 2)); // 9.869604401089358
print(random()); // 0.8456462589423794
print(round(PI)); // 3
print(sin(PI)); // 1.2246467991473532e-16
print(sqrt(PI)); // 1.7724538509055159
print(tan(PI)); // -1.2246467991473532e-16

Package Sidebar

Install

npm i shrtct

Weekly Downloads

1

Version

0.5.3

License

MIT

Unpacked Size

15.5 kB

Total Files

5

Last publish

Collaborators

  • engus-maze