Initial version
commit
4aeef9faeb
@ -0,0 +1,9 @@
|
||||
# @promistream/no-value
|
||||
|
||||
This module exports a symbol for representing a "no value" situation; it is used by various Promistream modules for cases where a callback provided to a stream may not always produce a value.
|
||||
|
||||
Importantly, this symbol is __not__ a part of the Promistreams specification; it is a convenience for stream modules that allow specifying a custom callback (eg. `map`) and that need some way to represent an absence of a value, where a `null` or `undefined` would be too ambiguous (eg. because it would be a valid value). You should only use this symbol when a stream tells you that it supports it.
|
||||
|
||||
## Why this is a stand-alone package
|
||||
|
||||
This ensures that there is only ever one symbol in use for this purpose, regardless of how many different stream modules you are using, and at what versions. This package will likely never receive an update, and it internally has a mechanism to ensure that only one global symbol is ever used across the application; if you somehow have multiple versions of this package loaded, all of them will export an identical symbol.
|
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
const NoValue = Symbol("NoValue");
|
||||
|
||||
if (global.__promistream_NoValue != null) {
|
||||
module.exports = global.__promistream_NoValue;
|
||||
} else {
|
||||
global.__promistream_NoValue = NoValue;
|
||||
module.exports = NoValue;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@promistream/no-value",
|
||||
"version": "1.0.0",
|
||||
"description": "Shared symbol for indicating within a stream that there is no value",
|
||||
"repository": {
|
||||
"url": "https://git.cryto.net/promistream/no-value.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [ "promistream", "symbol" ],
|
||||
"author": "Sven Slootweg <admin@cryto.net>",
|
||||
"license": "WTFPL OR CC0-1.0"
|
||||
}
|
Loading…
Reference in New Issue