@vyke/fns
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

@vyke/fns

Several functions with different scopes and small in nature

Installation

npm i @vyke/fns -D

API

outItem

Filter out an item from an array

const arr = [1, 2, 3, 4, 5]
const filtered = arr.filter(outItem(3))
console.log(filtered) // [1, 2, 4, 5]

compareBy

Sorts an array of objects by a property.

const arr = [
	{ name: 'John', age: 25 },
	{ name: 'Jane', age: 22 },
	{ name: 'Doe', age: 30 }
]
const sorted = arr.sort(compareBy('age'))
console.log(sorted)
// [
//  { name: 'Jane', age: 22 },
//  { name: 'John', age: 25 },
//  { name: 'Doe', age: 30 }
// ]

mapToUnit

Re-maps a number from one range to 0-1 and constrains the value.

const mapped = mapToUnit(50, 0, 100)
console.log(mapped) // 0.5

map

Re-maps a number from one range to another.

const mapped = map(50, 0, 100, 0, 200)
console.log(mapped) // 100

constrain

Constrains a value to not exceed a maximum and minimum value.

const constrained = constrain(150, 0, 100)
console.log(constrained) // 100

noop

A function that does nothing.

easeInSine

Easing function that accelerates quickly and then slows down.

easeOutSine

Easing function that decelerates quickly and then slows down.

easeInOutSine

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInQuad

Easing function that accelerates quickly and then slows down.

easeOutQuad

Easing function that decelerates quickly and then slows down.

easeInOutQuad

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInCubic

Easing function that accelerates quickly and then slows down.

easeOutCubic

Easing function that decelerates quickly and then slows down.

easeInOutCubic

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInQuart

Easing function that accelerates quickly and then slows down.

easeOutQuart

Easing function that decelerates quickly and then slows down.

easeInOutQuart

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInQuint

Easing function that accelerates quickly and then slows down.

easeOutQuint

Easing function that decelerates quickly and then slows down.

easeInOutQuint

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInExpo

Easing function that accelerates quickly and then slows down.

easeOutExpo

Easing function that decelerates quickly and then slows down.

easeInOutExpo

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInCirc

Easing function that accelerates quickly and then slows down.

easeOutCirc

Easing function that decelerates quickly and then slows down.

easeInOutCirc

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInBack

Easing function that accelerates quickly and then slows down.

easeOutBack

Easing function that decelerates quickly and then slows down.

easeInOutBack

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInElastic

Easing function that accelerates quickly and then slows down.

easeOutElastic

Easing function that decelerates quickly and then slows down.

easeInOutElastic

Easing function that accelerates quickly, slows down, and then accelerates again.

easeInBounce

Easing function that accelerates quickly and then slows down.

easeOutBounce

Easing function that decelerates quickly and then slows down.

easeInOutBounce

Easing function that accelerates quickly, slows down, and then accelerates again.

Others vyke projects

Readme

Keywords

none

Package Sidebar

Install

npm i @vyke/fns

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

42.6 kB

Total Files

32

Last publish

Collaborators

  • albizures