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

nano-kvso

v1.0.1

Published

a library package to convert object like nano.flag to key-val string of oneline

Downloads

3

Readme

一个类库包,用于在 js 中 将类似 nano.flag 的对象转换为 单行键值对文本

文件大小

file | size | gzip | brotli :---- | :---- | :---- | :---- dist/main.cjs | 1.58kb | 0.67kb | 0.56kb dist/main.js | 1.40kb | 0.60kb | 0.50kb dist/main.min.cjs | 1.15kb | 0.56kb | 0.48kb dist/main.min.js | 0.98kb | 0.50kb | 0.43kb dist/main.umd.cjs | 1.99kb | 0.80kb | 0.67kb dist/main.umd.min.cjs | 1.19kb | 0.64kb | 0.55kb

~~备注: 带有 min 标志的文件未上传~~

项目背景

曾经完成过这样的一个需求:由于某些原因,应用需要从架构A转到架构B,架构B 需要使用 单行键值对文本作为操作输入,操作内部会将其转换为 json 配置 。架构A 内部代码大多数的是简单的 json 配置,类似 nano.flag 。为了更简单的复用json配置,需要将这些简单的json配置转换为 单行键值对文本。

此处,提取核心功能之一 将简单的 json 配置 转换为单行键值对文本。

当前功能

  • 在 js 中 将类似 nano.flag 的对象转换为 单行键值对文本

用户安装

  • 您可以通过npm cdn 直接引入
<!-- unpkg.com/:package@:version/:file -->
<script src="https://unpkg.com/[email protected]/dist/main.js"></script>

<!-- jsdelivr -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/main.js"></script>

<!-- unpkg.zhimg.com -->
  • 您可以通过类库安装工具安装
npm i nano-kvso
yarn add nano-kvso
pnpm add nano-kvso

import {kvsoify,callPreset} from "nano-kvso"
// {a:'b',c:1} => 'a=b;c=1'
kvsoify({a:'b',c:1},'=;')

// {a:'b',c:1} => 'a=b&c=1'
kvsoify({a:'b',c:1},'=&')

// {a:'b',c:1} => 'a:b,c:1'
kvsoify({a:'b',c:1},':,')

// {a:'b',c:1} => 'a=b c=1'
kvsoify({a:'b',c:1},'= ')

let data = {a:'b',c:'d',wd:'d'}
callPreset(data,{modeStyle:'cli'}) //'-a=b -c=d --wd=d'

产品闭环

很小,功能单一,只做一件事—— 在 js 中 将类似 nano.flag 的对象转换为 单行键值对文本

产品运维

因为功能简单,决定了它的开发速度,更新速度,问题速度不会很慢

产品计划

因为功能单一,功能已经基本完成,后期主要根据命令包或其他类库包的需要,更新小补丁,不会有功能大改的情况出现,架构可能会随着技术的更新而有变化

许可证书

您可以使用它做任何事,但是请不要违发您所在地区法律。我不会为您的行为承担任何责任。

结束语

身为一名程序员我很自豪,虽然足不出户,指尖却有着可以改变世界 (可能有点大了) 自己的力量。即使不能实现,将其作为努力的目标也不错。———— 摘自 lencx

它就是一张白纸,您有什么设想,可以直接编码出来,怎么编,规则怎么定,有您决定。