https://github.com/afeiship/next-get-valid
Get valid data by condtion.
https://github.com/afeiship/next-get-valid
empty get is-empty is-valid next nil nx
Last synced: 4 months ago
JSON representation
Get valid data by condtion.
- Host: GitHub
- URL: https://github.com/afeiship/next-get-valid
- Owner: afeiship
- License: mit
- Created: 2018-09-07T06:34:53.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T02:50:25.000Z (over 1 year ago)
- Last Synced: 2025-05-22T22:09:54.294Z (7 months ago)
- Topics: empty, get, is-empty, is-valid, next, nil, nx
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-get-valid
> Get valid data by condtion.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```bash
yarn add @jswork/next-get-valid
```
## usage
```js
import '@jswork/next-get-valid';
const data = {
name: 'xiaoming',
age: 18,
email: ''
};
const isValidEmail = (value) => {
return value.indexOf('@') > -1;
};
const res = nx.getValid(data, 'email', 'example@email', isValidEmail);
// res -> 'example@email'
```
## license
Code released under [the MIT license](https://github.com/afeiship/next-get-valid/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/next-get-valid
[version-url]: https://npmjs.org/package/@jswork/next-get-valid
[license-image]: https://img.shields.io/npm/l/@jswork/next-get-valid
[license-url]: https://github.com/afeiship/next-get-valid/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-get-valid
[size-url]: https://github.com/afeiship/next-get-valid/blob/master/dist/next-get-valid.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/next-get-valid
[download-url]: https://www.npmjs.com/package/@jswork/next-get-valid