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

@52bot/plugin-jsondb

v0.0.4

Published

- 本地json数据库 - 支持存储函数 - 支持存储循环应用对象 ## 安装 ```shell yarn add @52bot/plugin-jsondb ``` ## 启用 1. 在 `52bot` 的配置文件中添加环境变量 `jsondb` ,值为 数据库存储文件名 2. 在 `52bot` 的配置文件的 `modulePlugins` 声明使用插件 `@52bot/plugin-jsondb` - 若配置文件中没有 `modulePlugins` 定义 ```text modulePlugins

Downloads

20

Readme

@52bot/plugin-jsondb

  • 本地json数据库
  • 支持存储函数
  • 支持存储循环应用对象

安装

yarn add @52bot/plugin-jsondb

启用

  1. 52bot 的配置文件中添加环境变量 jsondb ,值为 数据库存储文件名
  2. 52bot 的配置文件的 modulePlugins 声明使用插件 @52bot/plugin-jsondb
  • 若配置文件中没有 modulePlugins 定义
modulePlugins = @52bot/plugin-jsondb
  • 若配置文件中已有 modulePlugins 定义
modulePlugins = ...其他定义,@52bot/plugin-jsondb

使用

  • 完成上述配置后,你可在自己的插件中通过调用 plugin.jsondb 访问到数据库实例,并可通过该实例对数据库进行增删改查的操作
// 定义test为一个新对象或重写对象
plugin.jsondb.set('test',{name:'小黑子',hobby:['唱','跳','Rap','篮球']})

// 更改为已有对象添加新属性
plugin.jsondb.set('test.sex','男')
// 获取已有对象的值
plugin.jsondb.get('test.hobby') //返回数组 ['唱','跳','Rap','篮球']

// 删除指定值
plugin.jsondb.delete('test.sex')

// 删除数组中指定下标的元素
plugin.jsondb.splice('test.hobby',0,1) // 同数组原生方法 Array.split

// 从数组头部插入数据
plugin.jsondb.unshift('test.hobby','打游戏') // 同数组原生方法 Array.unshift

// 删除数组头部的第一个元素 
plugin.jsondb.shift('test.hobby') // 同数组原生方法 Array.shift

// 从数组尾部的插入数据 
plugin.jsondb.push('test.hobby','刷抖音') // 同数组原生方法 Array.push

// 删除数组尾部的第一个元素 
plugin.jsondb.pop('test.hobby') // 同数组原生方法 Array.pop

// 查询满足条件的元素
plugin.jsondb.filter('test.hobby',(item)=>{return item.length===1}) // 同数组原生方法 Array.filter

// 查询满足条件的第一个元素 
plugin.jsondb.find('test.hobby',(item)=>{return item.length===1}) // 同数组原生方法 Array.find