commit
748b7467e9
4 changed files with 43 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||
# virtual-property |
|||
|
|||
Documentation for this module has not been written yet. By the time it reaches 1.0.0, it will have full documentation. |
|||
|
|||
In the meantime, check out the `example.js` file in the repository for a usage demonstration. |
|||
|
|||
Rough notes for the future documentation are below: |
|||
|
|||
---- |
|||
|
|||
Marker object that is used to denote a 'virtual property' in a path segment for a validation error; a virtual property could be any property that doesn't really exist but that is semantically treated as a separately-checked value within a validator, such as the 'key property' of an `anyProperty` check, or the 'hostname property' of a parsed URL. |
@ -0,0 +1,13 @@ |
|||
"use strict"; |
|||
|
|||
const virtualProperty = require("./"); |
|||
|
|||
let property = virtualProperty("propertyName"); |
|||
|
|||
console.log(property); |
|||
/* |
|||
{ name: 'propertyName', |
|||
___validatem_isSpecial: true, |
|||
___validatem_isVirtualProperty: true, |
|||
___validatem_virtualPropertyVersion: 1 } |
|||
*/ |
@ -0,0 +1,10 @@ |
|||
"use strict"; |
|||
|
|||
module.exports = function virtualProperty(name) { |
|||
return { |
|||
name: name, |
|||
___validatem_isSpecial: true, |
|||
___validatem_isVirtualProperty: true, |
|||
___validatem_virtualPropertyVersion: 1, |
|||
}; |
|||
}; |
@ -0,0 +1,9 @@ |
|||
{ |
|||
"name": "@validatem/virtual-property", |
|||
"description": "Utility for creating an object representing a virtual property", |
|||
"version": "0.1.0", |
|||
"main": "index.js", |
|||
"repository": "http://git.cryto.net/validatem/virtual-property.git", |
|||
"author": "Sven Slootweg <admin@cryto.net>", |
|||
"license": "WTFPL OR CC0-1.0" |
|||
} |
Loading…
Reference in new issue