MCPcopy Create free account
hub / github.com/cryptii/cryptii / constructor

Method constructor

src/Field/Text.js:25–44  ·  view source on GitHub ↗

* Constructor * @param {string} name Field name * @param {object} [spec] Field spec * @param {?number} [spec.minLength=null] Minimum amount of characters * @param {?number} [spec.maxLength=null] Maximum amount of characters * @param {?number[]|string|Chain} [spec.whitelistChars=null]

(name, spec = {})

Source from the content-addressed store, hash-verified

23 * Wether to respect case sensitivity
24 */
25 constructor (name, spec = {}) {
26 super(name, spec)
27 this._viewPrototype = TextFieldView
28
29 this._value = Chain.wrap(spec.value || null)
30 this._minLength = null
31 this._maxLength = null
32 this._whitelistChars = null
33 this._blacklistChars = null
34 this._uniqueChars = false
35 this._caseSensitivity = null
36
37 // Apply field options
38 this.setMinLength(spec.minLength !== undefined ? spec.minLength : null, false)
39 this.setMaxLength(spec.maxLength !== undefined ? spec.maxLength : null, false)
40 this.setWhitelistChars(spec.whitelistChars || null, false)
41 this.setBlacklistChars(spec.blacklistChars || null, false)
42 this.setUniqueChars(spec.uniqueChars || false, false)
43 this.setCaseSensitivity(spec.caseSensitivity !== false, false)
44 }
45
46 /**
47 * Returns min text length.

Callers

nothing calls this directly

Calls 7

setMinLengthMethod · 0.95
setMaxLengthMethod · 0.95
setWhitelistCharsMethod · 0.95
setBlacklistCharsMethod · 0.95
setUniqueCharsMethod · 0.95
setCaseSensitivityMethod · 0.95
wrapMethod · 0.80

Tested by

no test coverage detected