Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/franciscop/afirmar
Assertion library, but with the name in Spanish
https://github.com/franciscop/afirmar
Last synced: 14 days ago
JSON representation
Assertion library, but with the name in Spanish
- Host: GitHub
- URL: https://github.com/franciscop/afirmar
- Owner: franciscop
- License: mit
- Created: 2019-04-26T15:02:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-16T12:11:45.000Z (over 5 years ago)
- Last Synced: 2024-09-24T09:13:09.521Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# afirmar
Tiny assertion library, but with the name in Spanish. Does nice comparisons by default. To install it:
```
npm install afirmar
```All of these **pass**:
```js
import assert from "afirmar";// Normal assert
assert(true);// Compare plain variables
assert(false, false);
assert(true, true);
assert("", "");
assert("abc", "abc");
assert(0, 0);
assert(1, 1);// Compare nested variables
assert(["a"], ["a"]);
assert(["a", "b"], ["a", "b"]);
assert({}, {});
assert({ a: "b" }, { a: "b" });
assert(Object.keys({ a: "b" }), ["a"]);// Check by RegExp
assert("abc", /^[a-z]+$/);
```All of these **fail**:
```js
assert(false);
assert(false, true);
assert(true, false);
assert("a", "b");
assert(1, 2);
assert("abc", "def");assert(["a"], ["b"]);
assert(["a", "b"], ["b", "a"]);
assert({ a: "b" }, { b: "a" });
assert(Object.keys({ a: "b" }), ["b"]);assert("123", /^[a-z]+$/);
assert("abc", /^[a-z]$/);
assert("abc", /^xxx$/);
```