Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zcong1993/mongoose-schema-parser
https://github.com/zcong1993/mongoose-schema-parser
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/zcong1993/mongoose-schema-parser
- Owner: zcong1993
- License: mit
- Created: 2019-09-05T17:25:44.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T14:14:04.000Z (over 2 years ago)
- Last Synced: 2023-02-28T14:37:11.642Z (over 1 year ago)
- Language: TypeScript
- Size: 187 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# mongoose-schema-parser
[![NPM version](https://img.shields.io/npm/v/@zcong/mongoose-schema-parser.svg?style=flat)](https://npmjs.com/package/@zcong/mongoose-schema-parser) [![NPM downloads](https://img.shields.io/npm/dm/@zcong/mongoose-schema-parser.svg?style=flat)](https://npmjs.com/package/@zcong/mongoose-schema-parser) [![CircleCI](https://circleci.com/gh/zcong1993/mongoose-schema-parser/tree/master.svg?style=shield)](https://circleci.com/gh/zcong1993/mongoose-schema-parser/tree/master) [![codecov](https://codecov.io/gh/zcong1993/mongoose-schema-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/zcong1993/mongoose-schema-parser)
> simple mongoose schema parser
## Install
```bash
$ yarn add @zcong/mongoose-schema-parser
```## Usage
```ts
import { parseSchema } from '@zcong/mongoose-schema-parser'const testSchema = new Schema({
id: ObjectId,
name: String,
age: {
type: Number
}
})console.log(parseSchema(testSchema))
// {
// id: {
// type: {
// type: TypeEnum.ObjectId,
// isArray: false
// }
// },
// name: {
// type: {
// type: TypeEnum.String,
// isArray: false
// }
// },
// age: {
// type: {
// type: TypeEnum.Number,
// isArray: false
// },
// details: {}
// }
// }
```## License
MIT © zcong1993