# @utilx/semantic

> ## Millis

Latest version **0.0.6** (published 2019-04-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install @utilx/semantic
pnpm add @utilx/semantic
yarn add @utilx/semantic
bun add @utilx/semantic
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2019-04-13 |
| First published | 2019-03-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lteam |

## Links

- npm: https://www.npmjs.com/package/@utilx/semantic
- Repository: https://github.com/edwinjhlee/semantic
- Homepage: https://github.com/edwinjhlee/semantic#readme
- Issues: https://github.com/edwinjhlee/semantic/issues
- npm.io page: https://npm.io/package/@utilx/semantic

## Recent versions

- 0.0.6 (latest) — 2019-04-13
- 0.0.5 — 2019-04-05
- 0.0.4 — 2019-03-25
- 0.0.3 — 2019-03-25
- 0.0.2 — 2019-03-25
- 0.0.1 — 2019-03-25
- 0.0.0 — 2019-03-25

## README

# semantic

## Result


## Error

我们需要改变使用throw [string]的习惯，抛出字符串，会失去stacks，对后面的debug非常不友好。
我们应该：

1. 原生的Error有哪些，尽量在这些Error上进行扩展
1. 能够设计一种方法，能够快速创建error的特殊类

## 原生Error

1. RangeError: 例如，端口号问题，`require('net').connect(-1);`
2. ReferenceError: 尝试引用不应该的Error，这个不是我们能用的，是内部触发
3. SyntaxError: 这个我只能理解为语法层次上的问题
4. TypeError: 类型不符合预期

## TimeStamp：语义化的时间戳

采用数字时间戳（1970以来的毫秒数）可读性很差
采用ISO标准的可读性不错，但里面的 `:-.` 一定程度对文件系统（扩展名判别），URL带来额外的负担。

因此，我们统一把这些分隔的标点符号变成`_`，并提供相应的stringify和parse函数。
我们还提供了一种在末尾加入了周六日的简写，在不少场合，这种额外的信息有助于信息回溯，对运维工作有一定的帮助。
这个简写是固定两位，从周日到周六分别是：`S0 M1 T2 W3 T4 F5 S6`

UTC标准时间：`timestamp.utc()`

```typescript
new Date().toISOString():
2019-04-13T04:58:18.809Z

timestamp.utc():
2019_04_13T04_58_18_809Z

timestamp.locale_weekday():
2019_04_13T12_58_18_809Z_S6
```

带时区偏移(笔者所在东八区)的：`timestamp.locale()`

```typescript
new Date().toISOString() + 偏移 :
2019-04-13T04:58:18.809Z-480

timestamp.locale():
2019_04_13T12_58_18_809Z_480

// 加入周六日信息
timestamp.locale_weekday():
2019_04_13T12_58_18_809Z_480_S6
```

## Millis

```typescript
millis({ year: 3, day: 3 }) => Class Millis(number)
```


## meter


## centimeter


## Latitude Longtitude

---
_Source: https://npm.io/package/@utilx/semantic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
