eject 0.2.2 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2014-2021 Alan Gutierrez
3
+ Copyright (c) 2014-2022 Alan Gutierrez
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/Makefile ADDED
@@ -0,0 +1,6 @@
1
+ all: test/readme.t.js README.md
2
+
3
+ test/readme.t.js: edify.md
4
+ edify --mode code $< > $@
5
+ README.md: edify.md
6
+ edify --mode text $< > $@
package/README.md CHANGED
@@ -1,20 +1,75 @@
1
- [![Actions Status](https://github.com/bigeasy/prospective/workflows/Node%20CI/badge.svg)](https://github.com/bigeasy/prospective/actions)
2
- [![codecov](https://codecov.io/gh/bigeasy/prospective/branch/master/graph/badge.svg)](https://codecov.io/gh/bigeasy/prospective)
1
+ [![Actions Status](https://github.com/bigeasy/eject/workflows/Node%20CI/badge.svg)](https://github.com/bigeasy/eject/actions)
2
+ [![codecov](https://codecov.io/gh/bigeasy/eject/branch/master/graph/badge.svg)](https://codecov.io/gh/bigeasy/eject)
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
 
5
5
  Convert a single set of events on an EventEmitter into a Promise.
6
6
 
7
- | What | Where |
7
+ | What | Where |
8
8
  | --- | --- |
9
- | Discussion | https://github.com/bigeasy/prospective/issues/1 |
10
- | Documentation | https://bigeasy.github.io/prospective |
11
- | Source | https://github.com/bigeasy/prospective |
12
- | Issues | https://github.com/bigeasy/prospective/issues |
13
- | CI | https://travis-ci.org/bigeasy/prospective |
14
- | Coverage: | https://codecov.io/gh/bigeasy/prospective |
15
- | License: | MIT |
9
+ | Discussion | https://github.com/bigeasy/eject/issues/1 |
10
+ | Documentation | https://bigeasy.github.io/eject |
11
+ | Source | https://github.com/bigeasy/eject |
12
+ | Issues | https://github.com/bigeasy/eject/issues |
13
+ | CI | https://travis-ci.org/bigeasy/eject |
14
+ | Coverage: | https://codecov.io/gh/bigeasy/eject |
15
+ | License: | MIT |
16
16
 
17
+ Eject installs from NPM.
17
18
 
18
19
  ```
19
- npm install prospective
20
+ npm install eject
21
+ ```
22
+
23
+ ## Overview
24
+
25
+ Extant is an implementation of SQL's COALESCE that I've used for some time to
26
+ deal with the fact that JavaScript truthiness will treat `''` and `0` as true so
27
+ the `||` operator can't always be used to create given or default one-liner.
28
+
29
+ ```javascript
30
+ const { compare, raise, equal } = require('eject')
31
+ ```
32
+
33
+ We use the name "extant" on NPM because we want the first extant argument.
34
+
35
+ ## Living `README.md`
36
+
37
+ This `README.md` is also a unit test using the
38
+ [Proof](https://github.com/bigeasy/proof) unit test framework. We'll use the
39
+ Proof `okay` function to assert out statements in the readme. A Proof unit test
40
+ generally looks like this.
41
+
42
+ ```javascript
43
+ require('proof')(4, async okay => {
44
+ okay('always okay')
45
+ okay(true, 'okay if true')
46
+ okay(1, 1, 'okay if equal')
47
+ okay({ value: 1 }, { value: 1 }, 'okay if deep strict equal')
48
+ })
49
+ ```
50
+
51
+ You can run this unit test yourself to see the output from the various
52
+ code sections of the readme.
53
+
54
+ ```text
55
+ git clone git@github.com:bigeasy/eject.git
56
+ cd eject
57
+ npm install --no-package-lock --no-save
58
+ node test/readme.t.js
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ The `'extant'` module exports a single `coalesce` function.
64
+
65
+ ```javascript
66
+ const { compare, raise, equal } = require('depature')
67
+ ```
68
+
69
+ Note that Extant is SQL's `COALESCE`. It returns the first non-null-like value,
70
+ that is the first value that is not `== null`, which would be `null` or
71
+ `undefined`. If there is no such argument it returns `null`.
72
+
73
+ ```javascript
74
+ okay('test')
20
75
  ```
package/eject.js CHANGED
@@ -39,7 +39,7 @@ class Once {
39
39
  }
40
40
  }
41
41
 
42
- module.exports = function (ee, events) {
42
+ exports.once = function (ee, events) {
43
43
  return new Once({
44
44
  ee: ee,
45
45
  events: Array.isArray(events) ? events : [ events ],
@@ -47,6 +47,6 @@ module.exports = function (ee, events) {
47
47
  })
48
48
  }
49
49
 
50
- module.exports.NULL = {
51
- once: () => {}
50
+ exports.once.NULL = {
51
+ emit: () => {}
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eject",
3
- "version": "0.2.2",
3
+ "version": "0.3.2",
4
4
  "description":
5
5
 
6
6
  "Convert a single set of events on an EventEmitter into a Promise.",