open-index/open-npm huggingface dataset:
npm package: @soggybag/justincase
Description: Utilities for managing string case
Latest version: 1.0.9

# justIncase


![GitHub commit activity](https://img.shields.io/github/commit-activity/y/soggybag/justincase)
![FooBar](https://img.shields.io/badge/Foo-Bar-%23f0f)
![npm](https://img.shields.io/npm/v/@soggybag/justincase)
![GitHub package.json version](https://img.shields.io/github/package-json/v/soggybag/justincase.svg)
![npm bundle size](https://img.shields.io/bundlephobia/min/@soggybag/justincase.svg)
[![install size](https://packagephobia.now.sh/badge?p=@soggybag/justincase)](https://packagephobia.now.sh/result?p=@soggybag/justincase)
[![Build Status](https://travis-ci.org/soggybag/justincase.svg?branch=master)](https://travis-ci.org/soggybag/justincase)
[![Coverage Status](https://coveralls.io/repos/github/soggybag/justincase/badge.svg?branch=master)](https://coveralls.io/github/soggybag/justincase?branch=master)

A library of string functions to help managing case.

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [capitalize](#capitalize)
-   [capitalizeAll](#capitalizeall)
-   [allCaps](#allcaps)

### capitalize

Capitalize first letter

Returns **any** String

### capitalizeAll

Capitalize all

Returns **any** String

### allCaps

Alias for toUpperCase()

Returns **any** String

## Code samples

    let hello = "Hello World"
    let foo = "foo bar"

Capitalize the first letter of a string

    console.log(hello.capitalize()) // Hello World
    console.log(foo.capitalize())	  // Foo bar

Capitalize the first letter of all words in a string

    console.log(foo.capitalizeAll()) // Foo Bar

Alternate case in a string, odd characters will be upper

    console.log(foo.oddCaps())   // fOo bAr
    console.log(hello.oddCaps()) // HElLo WOrLd

Alternate cae with even characters upper

    console.log(foo.evenCaps())  // FoO BaR

Replace all spaces with a hyphen "-"

    console.log(hello.kabobCase()) // Hello-World
    console.log(foo.kabobCase())   // foo-bar

Replaces all spaces with an underscore "\_"

    console.log(hello.snakeCase()) // Hello_World
    console.log(foo.snakeCase())   // foo_bar
npm package: @sognora/ui
Description: Shared UI components for Sognora projects
Latest version: 0.7.0

# @sognora/ui

Shared UI components for Sognora projects.

## Installation

```bash
npm install @sognora/ui
```

## Usage

```tsx
import { } from '@sognora/ui';
```

## Development

```bash
npm install
npm run dev       # Start docs server (port 3005)
npm run build     # Build package
```

## License

MIT
npm package: @sogody/create-experiment
Description: An AB Testing Experiment Generator
Author: sogody
Latest version: 1.0.17

# @sogody/create-experiment

> A generator for templates based on [Experiment Framework](https://www.npmjs.com/package/@sogody/experiment-framework).
## Usage

```bash
npx @sogody/create-experiment [EXPERIMENT_NAME]
```
## License

MIT &copy; [sogody](www.sogody.com)
npm package: @sogody/create-template
Description: An AB Testing Template Generator
Author: sogody
Latest version: 1.0.6

# @sogody/create-template

> A generator for templates based on [Template Framework](https://www.npmjs.com/package/@sogody/template-framework).
## Usage

```bash
npx @sogody/create-template [TEMPLATE_NAME]
```
## License

MIT &copy; [sogody](www.sogody.com)
npm package: @sogrey/js-common-sdk
Description: js基础通用函数工具SDK
Author: Sogrey
Latest version: 0.0.3

# js-common-SDK
js基础通用函数工具SDK

[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/Sogrey/js-common-SDK)


- `jsc.js` 是 CommonJS 模块。这是一种被 NodeJS 使用的模块类型，看起来像 const myModule = require('my-module')
- `jsc.module.js` 是 ECMAScript 模块，由 ES6 定义，看起来类似 import MyModule from 'my-module'
- `jsc.modern.js` modern ES2017 output (see below)
- `jsc.umd.js` 是 UMD 模块
- `jsc.d.ts` 是 TypeScript 类型描述文件


## Install
``` bash
npm i @sogrey/js-common-sdk
```
## Usage
umd:
``` html
<!-- <script src="./bundles/jsc.umd.js"></script> -->
<script src="./node_modules/@sogrey/js-common-SDK/bundles/jsc.umd.js"></script>
<script>
    console.log(JSC);
    console.log(JSC.CNumber.randomNum(1,100000));
    console.log(JSC.CNumber.format(19929682412));
</script>
```
module:
``` js
<script type="module">
    // import {CNumber} from './bundles/jsc.modern.js';
    // or
    import {CNumber} from './node_modules/@sogrey/js-common-sdk/bundles/jsc.module.js';
    console.log(CNumber.randomNum(1,10));
</script>
```
nodejs:
``` js
var JSC = require('./node_modules/@sogrey/js-common-sdk/bundles/jsc.js');
console.log(JSC.CNumber.randomNum(1, 10));
```
npm package: @sogrey/node-package-template
Description: npm 包模板
Author: Sogrey
Latest version: 1.0.7

# NodePackageTemplate
npm 包模板

## 注册npm账户

前往[官网](https://www.npmjs.com/)注册账号,记住用户名、密码、邮箱。

## 添加账户
使用以下命令添加npm的账户名、密码和邮箱即可：
``` bash
npm adduser
```
> 如果遇到使用了taobao镜像源导致添加账户失败，可切换回npm官方源:
> ``` bash
> npm config set registry https://registry.npmjs.org/
> ```
> 因为taobao镜像源是只读的。


## 发布到npm

发布前检查是否已存在同名package，在[官网](https://www.npmjs.com/)直接搜索你要命名的名字，即package.json中`name`字段，如果已存在需要更名，不得重复。

发布：
``` bash
npm publish
```
因为包名带有@符，使用如下命令发布到npm表示公开:
``` bash
npm publish --access public
```

> 每次发布版本需要修改版本号

## 撤销发布包

如果发现已经发布的版本有问题，可以进行撤销操作：
``` bash
npm unpublish <packagename>@<version>
```
如果有权限问题，撤销不了，可以添加`--force`。

撤销还是有诸多限制的：

1. 根据规范，只有在发包的24小时内才允许撤销发布的包（ unpublish is only allowed with versions published in the last 24 hours）
2. 即使你撤销了发布的包，发包的时候也不能再和被撤销的包的名称和版本重复了（即不能名称相同，版本相同，因为这两者构成的唯一标识已经被“占用”了）

## 单元测试
单元测试原则:

1. 对全新的代码或修改过的代码进行单元测试
1. 单元测试根据单元测试计划和方案进行，排除测试的随意性
1. 必须保证单元测试计划、单元测试方案、单元测试用例等经过评婶
1. 当测试用例的测试结果与预期结果不一致时，单元测试的执行人员需如实记录实际的测试结果
1. 只有当测试计划中的结束标准达到时，单元测试才能结束
1. 对被测试单元需达到的一定的代码覆盖率要求

测试库:[mocha](https://mochajs.org/)
``` bash
npm install -g mocha --verbos
npm install --save-dev chai --verbos
```

书写单元测试脚本： `tests/readAndWriteFile.js`
``` bash
#mocha tests/readAndWriteFile.js
npm run mocha:tests:readAndWriteFile
```

一键测试：
``` bash
#mocha --watch tests
npm run mocha:tests
```

生成测试报告：

``` bash
npm install --save-dev mochawesome --verbos
npm install --save-dev mocha --verbos
npm install -g istanbul --verbos
```

测试结果生成html报表:
``` bash
#mocha --reporter mochawesome tests
npm run mocha:reporter
```
能不能看看测试覆盖率呢
``` bash
#istanbul cover ./node_modules/mocha/bin/_mocha -- -t 2000 --recursive -R spec tests/
npm run istanbul:cover:tests
```

## 命令行

package.json 添加如下示例：
``` json
"bin": {
    "hello": "./bin/hello.js"
},
```

> 注：
>
> 开发模式可以使用：
>
> ``` bash
> sudo npm link   #添加命令行模式
> sudo npm unlink <package name> #取消命令行模式
> ``` 

执行示例命令：

``` bash
$ hello morning  A --n Sogrey B  --a 18 C
Good Morning
hello Sogrey,18
hello Sogrey,18
argv._ morning,A,B,C
写入成功？ true
写入的内容是： 测试写入文件数据：说明文档
```

## 参考

- [记npm包开发全过程](https://blog.csdn.net/white__cat/article/details/77051995)
- [通过npm写一个cli命令行工具](https://www.cnblogs.com/buzhiqianduan/p/7655612.html)
- [Node.js 命令行程序开发教程](https://www.ruanyifeng.com/blog/2015/05/command-line-with-node.html)
npm package: @sogrey/typescript-sdk-template
Description: 使用TypeScript开发SDK模板
Author: Sogrey
Latest version: 0.0.2

# TypeScript-SDK-Template
使用TypeScript开发SDK模板


- `tsdk.js` 是 CommonJS 模块。这是一种被 NodeJS 使用的模块类型，看起来像 const myModule = require('my-module')
- `tsdk.module.js` 是 ECMAScript 模块，由 ES6 定义，看起来类似 import MyModule from 'my-module'
- `tsdk.modern.js` modern ES2017 output (see below)
- `tsdk.umd.js` 是 UMD 模块
- `tsdk.d.ts` 是 TypeScript 类型描述文件

> In addition to the above formats, Microbundle also outputs a modern bundle specially designed to work in all modern browsers. This bundle preserves most modern JS features when compiling your code, but ensures the result runs in 95% of web browsers without needing to be transpiled. Specifically, it uses Babel's "bugfixes" mode (previously known as preset-modules) to target the set of browsers that support <script type="module"> - that allows syntax like async/await, tagged templates, arrow functions, destructured and rest parameters, etc. The result is generally smaller and faster to execute than the plain esm bundle.
> 
> 除了上述格式之外，Microbundle 还输出了一个`modern`专门设计用于所有现代浏览器的包。这个包在编译你的代码时保留了大多数现代 JS 特性，但确保结果在 95% 的 Web 浏览器中运行而无需转换。具体来说，它使用 Babel 的“bugfixes”模式 （以前称为preset-modules）来定位支持的浏览器集`<script type="module">`- 允许使用 `async/await`、标记模板、箭头函数、解构和休息参数等语法。结果是通常比普通esm包更小，执行速度更快。
>
> From Microbundle

## Install
``` bash
npm i @sogrey/typescript-sdk-template
```
## Usage
umd:
``` html
<!-- <script src="./bundles/tsdk.umd.js"></script> -->
<script src="./node_modules/@sogrey/typescript-sdk-template/bundles/tsdk.umd.js"></script>
<script>
    let greeter = new TSDK.Greeter("world");
    console.log(greeter.greet());
</script>
```
module:
``` js
<script type="module">
    import TSDK from './bundles/tsdk.module.js';
    let greeter = new TSDK.Greeter("world");
    console.log(greeter.greet());
</script>
```
nodejs:
``` js
let TSDK = require('@sogrey/typescript-sdk-template')

let greeter = new TSDK.Greeter("world");
console.log(greeter.greet());
```
npm package: @sogrey/what-to-eat
Description: 吃点啥
Author: Sogrey
Latest version: 0.0.3

# What To Eat
吃点啥

## 编译
``` bash
npm run build
```
## Install
``` bash
npm i @sogrey/what-to-eat
```
## Usage

``` js
let api = require('@sogrey/what-to-eat')

var what2eat = new api.WhatToEat();

var cuisine = what2eat.whatToEat();
console.log('本次吃点啥：', cuisine);
```

## 命令行使用

``` bash
$ WhatToEat
本次吃点啥： 川湘菜
```