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

kuu-tools

v0.3.1

Published

Kuu front-end tools

Downloads

49

Readme

kuu-tools

NPM version Build Status NPM downloads Dependencies

Kuu front-end tools

Install

npm i kuu-tools

Request utils

GET

import { get } from 'kuu-tools'

const data = await get('/member/get?foo=1&bar=2')

POST

import { post } from 'kuu-tools'

const data = await post('/member/signup', { user: 'foo', name: 'bar' })

PUT

import { put } from 'kuu-tools'

const data = await put('/member/signup?foo=1&bar=2', { user: 'foo', name: 'bar' })

DELETE

import { del } from 'kuu-tools'

const data = await del('/member/signup?foo=1&bar=2', { user: 'foo', name: 'bar' })

Model SDK

Create

https://github.com/kuuland/kuu#create-record

import { create } from 'kuu-tools'

// create a role
const data = await create('Role', { Code: 'foo', Name: 'bar' })

// batch create roles
const data = await create('Role', [{ Code: 'foo1', Name: 'bar1' }, { Code: 'foo2', Name: 'bar2' }])

Update

https://github.com/kuuland/kuu#update-fields

import { update } from 'kuu-tools'

// update a param
const data = await update('param', { ID: 5 }, { Value: 'new value', Name: 'foobar' })

// batch updates
const data = await update('param', { ID: { $in: [5, 10, 11] } }, { Value: 'new value' }, true)

Delete

https://github.com/kuuland/kuu#delete-record

import { remove } from 'kuu-tools'

// delete a param
const data = await remove('param', { ID: 5 })

// batch delete
const data = await remove('param', { ID: { $in: [5, 10, 11] } }, true)

// batch and unsoft delete
const data = await remove('param', { ID: { $in: [5, 10, 11] } }, true, true)

Query

https://github.com/kuuland/kuu#query

import { list, one, id } from 'kuu-tools'

// list query
const data = await list('param', { cond: { ID: { $in: [5, 10, 11] } }, page: 3, sort: '-CreatedAt' })

// query only one record
const data = await one('param', { cond: { Name: 'foo' } })

// query by id
const data = await id('param', 11)

i18n

{
     "hello": "你好",
     "welcome": "欢迎 {{name}}"
}
import { withLocale } from 'kuu-tools'

class Param extends React.Component {
  render () {
    return (
      <div>
        <div>{this.props.L('hello', 'Hello')}</div>                         /* => 你好 */
        <div>{this.props.L('not_found', 'Not found')}</div>                 /* => Not found */
        <div>{this.props.L('welcome', 'Welcome Kuu', { name: 'Kuu' }}</div> /* => 欢迎 Kuu */
      </div>
    )
  }
}

export default withLocale(Param)

Notes:

  1. this.props.L can only be used in render, otherwise it will not respond to language updates in real time.
  2. withLocale(Param)
  3. withLocale(withRouter(Param))
  4. withLocale(connect(mapStateToProps)(withRouter(Param)))

Message supports the mustache syntax.