New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

easing-coordinates

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easing-coordinates - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

dist/cjs/index.js

35

dist/index.js

@@ -1,14 +0,10 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const cubic_coordinates_1 = require('./lib/cubic-coordinates')
exports.cubicCoordinates = cubic_coordinates_1.cubicCoordinates
const easing_map_1 = require('./lib/easing-map')
const shared = require('./lib/shared')
const steps_coordinates_1 = require('./lib/steps-coordinates')
exports.stepsCoordinates = steps_coordinates_1.stepsCoordinates
import { cubicCoordinates } from './lib/cubic-coordinates'
import easingShorthandMap from './lib/easing-map'
import * as shared from './lib/shared'
import { stepsCoordinates } from './lib/steps-coordinates'
function easingCoordinates(easingFunction, hypotSize, incrementSize) {
const errorMsgStart = `Error parsing "${easingFunction}".`
// If a shorthand like "ease-in" is provided then convert to equivalent cubic-bezier
if (easing_map_1.default[easingFunction]) {
easingFunction = easing_map_1.default[easingFunction]
if (easingShorthandMap[easingFunction]) {
easingFunction = easingShorthandMap[easingFunction]
}

@@ -29,3 +25,3 @@ // If we think it's a steps function

}
return steps_coordinates_1.stepsCoordinates(stepCount, stepSkip)
return stepsCoordinates(stepCount, stepSkip)
}

@@ -46,10 +42,3 @@ // If we think it's a cubic-bezier function

})
return cubic_coordinates_1.cubicCoordinates(
x1,
y1,
x2,
y2,
hypotSize,
incrementSize
)
return cubicCoordinates(x1, y1, x2, y2, hypotSize, incrementSize)
}

@@ -63,3 +52,7 @@ // If it's not cubic bezier or steps it's not an easing function

}
exports.easingCoordinates = easingCoordinates
exports.default = easingCoordinates
export {
stepsCoordinates,
cubicCoordinates,
easingCoordinates,
easingCoordinates as default,
}

62

dist/index.test.js

@@ -1,4 +0,2 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const index_1 = require('./index')
import { cubicCoordinates, easingCoordinates, stepsCoordinates } from './index'
const cubicTest = [

@@ -115,50 +113,46 @@ { x: 0, y: 0 },

test('coordinates for "cubic-bezier(0.5, 0, 0.5, 1)"', () => {
expect(index_1.easingCoordinates('cubic-bezier(0.5, 0, 0.5, 1)')).toEqual(
cubicTest
)
expect(easingCoordinates('cubic-bezier(0.5, 0, 0.5, 1)')).toEqual(cubicTest)
})
test('coordinates for "cubic-bezier(0, 0, 0.5, 2)"', () => {
expect(index_1.easingCoordinates('cubic-bezier(0, 0, 0.5, 2)')).toEqual(
cubicTest2
)
expect(easingCoordinates('cubic-bezier(0, 0, 0.5, 2)')).toEqual(cubicTest2)
})
test('coordinates for "ease"', () => {
expect(index_1.easingCoordinates('ease')).toEqual(easeTest)
expect(easingCoordinates('ease')).toEqual(easeTest)
})
test('ease shorthand is the same as equivalent cubic-bezier', () => {
expect(index_1.easingCoordinates('ease-in-out')).toEqual(
index_1.easingCoordinates('cubic-bezier(0.42, 0, 0.58, 1)')
expect(easingCoordinates('ease-in-out')).toEqual(
easingCoordinates('cubic-bezier(0.42, 0, 0.58, 1)')
)
})
test('coordinates for "ease" with a bigger hypotSize shoul be fewer and further appart', () => {
expect(index_1.easingCoordinates('ease', 0.2)).toEqual(easeTestHypot)
expect(easingCoordinates('ease', 0.2)).toEqual(easeTestHypot)
})
test('easingCoordinates returns the same as cubicCoordinates', () => {
expect(index_1.easingCoordinates('cubic-bezier(0.42, 0, 0.58, 1)')).toEqual(
index_1.cubicCoordinates(0.42, 0, 0.58, 1)
expect(easingCoordinates('cubic-bezier(0.42, 0, 0.58, 1)')).toEqual(
cubicCoordinates(0.42, 0, 0.58, 1)
)
})
test('easingCoordinates returns the same as stepsCoordinates', () => {
expect(index_1.easingCoordinates('steps(4, skip-end)')).toEqual(
index_1.stepsCoordinates(4, 'skip-end')
expect(easingCoordinates('steps(4, skip-end)')).toEqual(
stepsCoordinates(4, 'skip-end')
)
})
test('coordinates for "steps(4, skip-end)"', () => {
expect(index_1.easingCoordinates('steps(4, skip-end)')).toEqual(stepTestEnd)
expect(easingCoordinates('steps(4, skip-end)')).toEqual(stepTestEnd)
})
test('coordinates for "steps(4)" - the default is "skip-end" as per spec', () => {
expect(index_1.easingCoordinates('steps(4)')).toEqual(stepTestEnd)
expect(easingCoordinates('steps(4)')).toEqual(stepTestEnd)
})
test('coordinates for "steps(4, skip-none)"', () => {
expect(index_1.easingCoordinates('steps(4, skip-none)')).toEqual(stepTestNone)
expect(easingCoordinates('steps(4, skip-none)')).toEqual(stepTestNone)
})
test('coordinates for "steps(4, skip-both)"', () => {
expect(index_1.easingCoordinates('steps(4, skip-both)')).toEqual(stepTestBoth)
expect(easingCoordinates('steps(4, skip-both)')).toEqual(stepTestBoth)
})
test('old and new steps syntax should yield the same', () => {
expect(index_1.easingCoordinates('steps(4, skip-end)')).toEqual(
index_1.easingCoordinates('steps(4, end)')
expect(easingCoordinates('steps(4, skip-end)')).toEqual(
easingCoordinates('steps(4, end)')
)
expect(index_1.easingCoordinates('steps(2, skip-start)')).toEqual(
index_1.easingCoordinates('steps(2, start)')
expect(easingCoordinates('steps(2, skip-start)')).toEqual(
easingCoordinates('steps(2, start)')
)

@@ -171,3 +165,3 @@ })

function incorrectInput() {
index_1.easingCoordinates('steps()')
easingCoordinates('steps()')
}

@@ -178,3 +172,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('steps(4, skip-end, 3)')
easingCoordinates('steps(4, skip-end, 3)')
}

@@ -185,3 +179,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('steps(skip-end, 4)')
easingCoordinates('steps(skip-end, 4)')
}

@@ -192,3 +186,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('steps(4, 4)')
easingCoordinates('steps(4, 4)')
}

@@ -199,3 +193,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('steps(4, skip-forward)')
easingCoordinates('steps(4, skip-forward)')
}

@@ -206,3 +200,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('cubic-bezier(0.5, 0, 0.5)')
easingCoordinates('cubic-bezier(0.5, 0, 0.5)')
}

@@ -213,3 +207,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('cubic-bezier(0.5, 0, 0.5, 1, 1)')
easingCoordinates('cubic-bezier(0.5, 0, 0.5, 1, 1)')
}

@@ -220,3 +214,3 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('cubic-bezier(0.5, hello, 0.5, 1)')
easingCoordinates('cubic-bezier(0.5, hello, 0.5, 1)')
}

@@ -227,5 +221,5 @@ expect(incorrectInput).toThrowError()

function incorrectInput() {
index_1.easingCoordinates('funky(0.5, 0.5, 0.5, 1, 1)')
easingCoordinates('funky(0.5, 0.5, 0.5, 1, 1)')
}
expect(incorrectInput).toThrowError()
})

@@ -1,6 +0,4 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const BezierEasing = require('bezier-easing')
const shared = require('./shared')
function cubicCoordinates(
import * as BezierEasing from 'bezier-easing'
import * as shared from './shared'
export function cubicCoordinates(
x1,

@@ -50,2 +48,1 @@ y1,

}
exports.cubicCoordinates = cubicCoordinates

@@ -1,3 +0,1 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const easeMap = {

@@ -9,2 +7,2 @@ ease: 'cubic-bezier(0.25, 0.1, 0.25, 1)',

}
exports.default = easeMap
export { easeMap as default }

@@ -1,3 +0,1 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const getParenthesisContent = str => {

@@ -12,10 +10,10 @@ return str

Number.isNaN(Number(str)) ? str : Number(str)
exports.roundToMaxTenDecimals = num => Number(`${+num.toFixed(10)}`)
exports.getCoordinate = (x, y) => {
export const roundToMaxTenDecimals = num => Number(`${+num.toFixed(10)}`)
export const getCoordinate = (x, y) => {
return {
x: exports.roundToMaxTenDecimals(x),
y: exports.roundToMaxTenDecimals(y),
x: roundToMaxTenDecimals(x),
y: roundToMaxTenDecimals(y),
}
}
exports.getFunctionArguments = functionAsString => {
export const getFunctionArguments = functionAsString => {
return getParenthesisContent(functionAsString).map(arg =>

@@ -22,0 +20,0 @@ convertToNumberMaybe(arg)

@@ -1,5 +0,3 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
const shared = require('./shared')
function stepsCoordinates(steps, skip = 'skip-end') {
import * as shared from './shared'
export function stepsCoordinates(steps, skip = 'skip-end') {
const coordinates = []

@@ -28,2 +26,1 @@ let n = 0

}
exports.stepsCoordinates = stepsCoordinates
{
"name": "easing-coordinates",
"version": "1.0.2",
"version": "1.0.3",
"description":

@@ -11,5 +11,5 @@ "Utility script that takes an easing function as input and outputs a coordinate set with adjustable precision/resolution.",

"files": ["dist"],
"main": "dist/index.js",
"module": "dist/es6/index.js",
"types": "dist/es6/index.d.ts",
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {

@@ -19,6 +19,7 @@ "clean": "rm -rf dist",

"es6-watch": "tsc --watch",
"cjs-build": "tsc --module commonjs --declaration false --outDir dist",
"cjs-build": "tsc --module commonjs --declaration false --outDir dist/cjs",
"cjs-watch":
"tsc --watch --module commonjs --declaration false --outDir dist",
"build": "npm run clean && npm run es6-build & npm run cjs-build",
"tsc --watch --module commonjs --declaration false --outDir dist/cjs",
"build":
"npm run clean && npm run es6-build & npm run cjs-build; pretty-quick",
"watch": "npm run es6-watch & npm run cjs-watch",

@@ -43,6 +44,6 @@ "test": "jest",

"devDependencies": {
"@types/jest": "^22.2.0",
"@types/jest": "^22.2.2",
"coveralls": "^3.0.0",
"husky": "^0.14.3",
"jest": "^22.4.2",
"jest": "^22.4.3",
"prettier": "^1.11.1",

@@ -53,5 +54,4 @@ "pretty-quick": "^1.4.1",

"tslint-config-prettier": "^1.10.0",
"typescript": "^2.7.2",
"typescript-eslint-parser": "^14.0.0"
"typescript": "^2.7.2"
}
}

@@ -1,21 +0,15 @@

<h1 align="center">Easing Coordinates</h1>
# Easing Coordinates
<p align="center">
<a href="https://travis-ci.org/larsenwork/easing-coordinates">
<img alt="Travis" src="https://travis-ci.org/larsenwork/easing-coordinates.svg?branch=master">
</a><a href="https://coveralls.io/github/larsenwork/easing-coordinates?branch=master">
<img alt="Code coverage" src="https://coveralls.io/repos/github/larsenwork/easing-coordinates/badge.svg?branch=master">
</a><a href="https://www.npmjs.com/package/easing-coordinates">
<img alt="npm version" src="https://img.shields.io/npm/v/easing-coordinates.svg">
</a><a href="https://www.npmjs.com/package/easing-coordinates">
<img alt="monthly downloads" src="https://img.shields.io/npm/dm/easing-coordinates.svg">
</a><a href="https://github.com/larsenwork/easing-coordinates/blob/master/LICENSE">
<img alt="MIT License" src="https://img.shields.io/github/license/larsenwork/easing-coordinates.svg">
</a><a href="https://github.com/prettier/prettier">
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg">
</a><a href="https://twitter.com/larsenwork">
<img alt="Follow Larsenwork on Twitter" src="https://img.shields.io/twitter/follow/larsenwork.svg?label=follow+larsenwork">
</a>
</p>
[![NPM Version][npm-img]][npm]
[![NPM Monthly Downloads][dm-img]][npm]
[![Build Status][ci-img]][ci]
[![Code Coverage][cvg-img]][cvg]
[![Dependency status][dpd-img]][dpd]
<br>
[![MIT License][mit-img]][mit]
[![Code Style: Prettier][prt-img]][prt]
[![Follow Larsenwork on Twitter][twt-img]][twt]
<br>
## Usage

@@ -25,3 +19,3 @@

[single-transition-timing-functions](https://developer.mozilla.org/en-US/docs/Web/CSS/single-transition-timing-function)
as input and returns a set of "low-poly" xy-coordinates.
as input and returns an array of "low-poly" xy-coordinates.

@@ -103,4 +97,8 @@ ```js

<br>
## Build
(See package.json for more scripts)
```bash

@@ -117,4 +115,16 @@ # Checkout and then

## PRs, suggestions, etc
Are very welcome 🤗
[npm-img]: https://img.shields.io/npm/v/easing-coordinates.svg?longCache=true&style=flat-square
[npm]: https://www.npmjs.com/package/easing-coordinates
[dm-img]: https://img.shields.io/npm/dm/easing-coordinates.svg?longCache=true&style=flat-square
[ci-img]: https://img.shields.io/travis/larsenwork/easing-coordinates.svg?branch=master&longCache=true&style=flat-square
[ci]: https://travis-ci.org/larsenwork/easing-coordinates
[cvg-img]: https://img.shields.io/coveralls/larsenwork/easing-coordinates.svg?longCache=true&style=flat-square
[cvg]: https://coveralls.io/github/larsenwork/easing-coordinates
[dpd-img]: https://img.shields.io/david/larsenwork/easing-coordinates.svg?longCache=true&style=flat-square
[dpd]: https://david-dm.org/larsenwork/easing-coordinates
[mit-img]: https://img.shields.io/github/license/larsenwork/easing-coordinates.svg?longCache=true&style=flat-square
[mit]: https://github.com/larsenwork/easing-coordinates/blob/master/LICENSE
[twt-img]: https://img.shields.io/twitter/follow/larsenwork.svg?label=follow+larsenwork
[twt]: https://twitter.com/larsenwork
[prt-img]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?longCache=true&style=flat-square
[prt]: https://github.com/prettier/prettier
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc