npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fdutil/core

v0.0.29

Published

frontend develop utils

Downloads

3

Readme

@fdutil

front end developer toolkit

build version issues forks stars license download

env

browser

install

npm install @fdutil/core
yarn add @fdutil/core
pnpm install @fdutil/core

usage

core

better storage

import { baseStorage, getStorageData, initLFInstance } from '@fdutil/core'

interface UserInfoInterface {
  name: string
  age: number
  // ...
}

enum StorageKeys {
  USER = 'user'
  // ...
}

const AppKey = 'your app key'
initLFInstance(AppKey)

baseStorage<StorageKeys, UserInfoInterface>(storageKey, { name: 'Jeff', age: 18 })
getStorageData('item', { default: true })

image

import { getImgOpaqueOffsets, getImgOriginUrls } from '@fdutil/core'

getImgOpaqueOffsets(imgUrl).then(({ x, y, w, h }) => {
  console.log('your img\'s opaque part offsets: ', x, y, w, h)
})

const urls = getImgOriginUrls('sadhihttp://a.g*o 32 \^!.webp*.jpg)w \\nebpd https:// sahttps://% ^&   *.png(*&^')
console.log(urls) // ['http://a.g*o32^!.webp', 'https://%^&*.png']

net

import { paramsToQuery, paramsToFormData } from '@fdutil/core'

const params = {
  a: 1,
  b: 2,
  c: 3,
}
const url = '/example.com'
paramsToQuery(url, params) // '/example.com?a=1&b=2&c=3'
paramsToFormData(params) // to be FormData

components

import { PlaceholderImg } from '@fdutil/components'
<PlaceholderImg :wh="300" bghex="0000FF" texthex="FFFFFF" text="Hello, I'm PlaceholderImg text." />

request

web request with abort

import { getJSONReq, postJSONReq, uniRequest } from '@fdutil/request'
const url = 'https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=7'
let ac = null, pac = null
getJSONReq(url, { ac })

postJSONReq(url, body, { pac })
// abort request
ac.abort()
pac.abort()

uni-app request

uniRequest(url, {
  method: 'GET' // 'GET' | 'POST',
  body, // post body,
  headers // request headers
})

Alt

License

MIT License © 2022 Senar