Socket
Socket
Sign inDemoInstall

@mathigon/core

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mathigon/core - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

.eslintrc.js

@@ -25,3 +25,3 @@ module.exports = {

'guard-for-in': 'error',
'indent': ['error', 2],
'indent': ['error', 2, {SwitchCase: 1}],
'key-spacing': 'error',

@@ -72,2 +72,3 @@ 'keyword-spacing': 'error',

'switch-colon-spacing': 'error',
'template-curly-spacing': ['error', 'never'],
'yield-star-spacing': ['error', 'after'],

@@ -74,0 +75,0 @@ '@typescript-eslint/no-unused-vars': ['warn', {'varsIgnorePattern': '^_', 'argsIgnorePattern': '^_'}],

@@ -32,3 +32,3 @@ /** Object Map Interface. */

*/
export declare function cache<T>(fn: (...args: unknown[]) => T): (...args: unknown[]) => NonNullable<T>;
export declare function cache<T, Args extends unknown[]>(fn: (...args: Args) => T): (...args: Args) => NonNullable<T>;
/**

@@ -41,4 +41,4 @@ * Function wrapper that prevents a function from being executed more than once

*/
export declare function throttle(fn: (...args: unknown[]) => void, t?: number, forceDelay?: boolean): (...args: unknown[]) => void;
export declare function throttle<Args extends unknown[]>(fn: (...args: Args) => void, t?: number, forceDelay?: boolean): (...args: Args) => void;
/** Safe wrapper for JSON.parse. */
export declare function safeToJSON(str?: string, fallback?: unknown): unknown;
{
"name": "@mathigon/core",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "homepage": "https://mathigon.io/core",

@@ -52,3 +52,3 @@ // =============================================================================

const alpha = this.a >= 1 ? '' : pad2(Math.round(this.a * 255).toString(16));
return `#${ c.join('') }${alpha}`;
return `#${c.join('')}${alpha}`;
}

@@ -59,3 +59,3 @@

const c = [this.r, this.g, this.b].map(x => Math.round(x)).join(',');
return `rgba(${ c },${ this.a })`;
return `rgba(${c},${this.a})`;
}

@@ -62,0 +62,0 @@

@@ -103,5 +103,5 @@ // =============================================================================

*/
export function cache<T>(fn: (...args: unknown[]) => T) {
export function cache<T, Args extends unknown[]>(fn: (...args: Args) => T) {
const cached = new Map<string, T|CacheError>();
return function(...args: unknown[]) {
return function(...args: Args) {
const argString = args.join('--');

@@ -129,7 +129,7 @@ if (!cached.has(argString)) {

*/
export function throttle(fn: (...args: unknown[]) => void, t = 0, forceDelay = false) {
export function throttle<Args extends unknown[]>(fn: (...args: Args) => void, t = 0, forceDelay = false) {
let delay = false;
let repeat = false;
return (...args: unknown[]) => {
return (...args: Args) => {
if (delay) {

@@ -136,0 +136,0 @@ repeat = true;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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