Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bothrs/util

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bothrs/util - npm Package Compare versions

Comparing version 1.16.0 to 1.17.0

async.ts

10

airtable-env.ts

@@ -34,3 +34,3 @@ import {

tableName: string,
filter: SelectOptions
filter: SelectOptions = {}
): Promise<FieldSet | null> {

@@ -42,3 +42,3 @@ return firstPure(env, tableName, filter)

tableName: string,
filter: SelectOptions
filter: SelectOptions = {}
): Promise<FieldSet[]> {

@@ -50,4 +50,4 @@ return selectPure(env, tableName, filter)

tableName: string,
filter: SelectOptions,
prepend?: FieldSet[]
filter: SelectOptions = {},
prepend: FieldSet[] = []
): Promise<FieldSet[]> {

@@ -60,3 +60,3 @@ return selectAllPure(env, tableName, filter, prepend)

id: string,
fields: SelectOptions
fields: FieldSet
): Promise<FieldSet> {

@@ -63,0 +63,0 @@ return updatePure(env, tableName, id, fields)

@@ -56,3 +56,3 @@ import { serialize } from './url'

tableName: string,
filter: SelectOptions
filter: SelectOptions = {}
): Promise<FieldSet | null> {

@@ -67,3 +67,3 @@ env.log && env.log('first', tableName, filter)

tableName: string,
filter: SelectOptions
filter: SelectOptions = {}
): Promise<FieldSet[]> {

@@ -88,3 +88,3 @@ env.log && env.log('select', tableName, filter)

tableName: string,
filter: SelectOptions,
filter: SelectOptions = {},
prepend: FieldSet[] = []

@@ -197,3 +197,3 @@ ): Promise<FieldSet[]> {

view?: string
offset: number
offset?: number
}

@@ -200,0 +200,0 @@

/**
* Memoize function
*
* @param func - Expensive function
* @param timeout - Milliseconds to wait before running the function again
* @returns Function that returns optimistic value of `func`
* @param {Function} func - Expensive function
* @param {number} [timeout] - Milliseconds to wait before running the function again
* @returns {Function} Function that returns optimistic value of `func`
*/
export function memo(func, timeout) {
export function memo<T extends (...args: any[]) => any>(
func: T,
timeout?
): (...funcArgs: Parameters<T>) => ReturnType<T> {
const cache = {}
const f = function(a, b, c) {
const f = function (...[a, b, c]: Parameters<T>): ReturnType<T> {
const key = JSON.stringify([a, b, c])

@@ -31,10 +34,14 @@ if (!cache[key]) {

*
* @param func - Expensive function
* @param timeout - Milliseconds to wait before running the function again
* @returns Function that returns optimistic value of `func`
* @param {Function} func - Expensive function
* @param {number} [timeout] - Milliseconds to wait before running the function again
* @returns {Function} Function that returns optimistic value of `func`
*/
export function optimist(func, timeout = 60000) {
export function optimist<T extends (...args: any[]) => any>(
func: T,
timeout = 60000
): (...funcArgs: Parameters<T>) => ReturnType<T> {
const cache = {}
const time = {}
const f = function(a, b, c) {
const f = function (...[a, b, c]: Parameters<T>): ReturnType<T> {
const key = JSON.stringify([a, b, c])

@@ -41,0 +48,0 @@ if (!cache[key]) {

{
"name": "@bothrs/util",
"version": "1.16.0",
"version": "1.17.0",
"description": "Common helper functions",

@@ -9,4 +9,5 @@ "license": "MIT",

"dev": "yarn lint",
"fix": "prettier --write -l *.mjs",
"lint": "prettier -l *.mjs",
"fix": "prettier --write -l *.mjs *.ts",
"lint": "prettier -l *.mjs *.ts",
"tsc": "tsc -w --noEmit",
"prepare": "yarn fix",

@@ -17,3 +18,6 @@ "prepublishOnly": "npm run build"

"devDependencies": {
"prettier": "^1.18.2",
"@types/node": "^13.11.1",
"@types/node-fetch": "^2.5.4",
"node-fetch": "^2.6.0",
"prettier": "2",
"rollup-plugin-multi-entry": "^2.1.0",

@@ -44,13 +48,4 @@ "rollup-plugin-typescript2": "^0.25.3",

"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"jsxBracketSameLine": false,
"parser": "babel",
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"

@@ -57,0 +52,0 @@ },

@@ -1,24 +0,14 @@

export function id(len = 10) {
export function id(len = 10): string {
return Array.from(new Array(len))
.map(() =>
Math.random()
.toString(36)
.charAt(5)
)
.map(() => Math.random().toString(36).charAt(5))
.join('')
}
export function str62(len = 10) {
return Array.apply(null, Array(len))
.map(char62)
.join('')
export function str62(len = 10): string {
return Array.apply(null, Array(len)).map(char62).join('')
}
export function str36(len = 10) {
export function str36(len = 10): string {
return Array.apply(null, Array(len))
.map(() =>
Math.random()
.toString(36)
.charAt(5)
)
.map(() => Math.random().toString(36).charAt(5))
.join('')

@@ -25,0 +15,0 @@ }

@@ -88,6 +88,3 @@ export function serialize(obj: any) {

export function origin(url: string) {
return url
.split('/')
.slice(0, 3)
.join('/')
return url.split('/').slice(0, 3).join('/')
}

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

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

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