Gathering detailed insights and metrics for ampersand-array-input-view
Gathering detailed insights and metrics for ampersand-array-input-view
Gathering detailed insights and metrics for ampersand-array-input-view
Gathering detailed insights and metrics for ampersand-array-input-view
npm install ampersand-array-input-view
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
41,436
Last Day
4
Last Week
18
Last Month
98
Last Year
629
6 Stars
65 Commits
8 Forks
7 Watching
1 Branches
11 Contributors
Minified
Minified + Gzipped
Latest Version
6.1.0
Package Id
ampersand-array-input-view@6.1.0
Size
6.50 kB
NPM Version
4.0.5
Node Version
7.4.0
Cumulative downloads
Total Downloads
Last day
300%
4
Compared to previous day
Last week
-30.8%
18
Compared to previous week
Last month
263%
98
Compared to previous month
Last year
-29%
629
Compared to previous year
Lead Maintainer: Michael Garvin
A view module for intelligently rendering and validating inputs that should produce an array of values. Works well with ampersand-form-view.
It does the following:
npm install ampersand-array-input-view
The only required attribute is a name. Everything else is optional.
1var InputView = require('ampersand-array-input-view'); 2 3 4var field = new InputView({ 5 // form input's `name` attribute 6 name: 'client_name', 7 // You can replace the built-in template for the parent item 8 // just give it an html string. Make sure it has a single "root" element that contains: 9 // - an element with a `data-hook="label"` attribute 10 // - an element with a `data-hook="fieldContainer"` this is where individual fields go 11 // - an element with a `data-hook="main-message-container"` attribute (this we'll show/hide) 12 // - an elememt with a `data-hook="main-message-text"` attribute (where message text goes for error) 13 template: // some HTML string, 14 // Template for individual view. It should be a string of HTML 15 // Make sure it has a single "root" element that contains 16 // - an element with a `data-hook="label"` attribute 17 // - an element with a `data-hook="message-container"` attribute (this we'll show/hide) 18 // - an elememt with a `data-hook="message-text"` attribute (where message text goes for error) 19 fieldTemplate // HTML string 20 // Label name 21 label: 'App Name', 22 // Optional placeholder attribute 23 placeholder: 'My Awesome App', 24 // optional intial value if it has one 25 value: ['hello'], 26 // optional, this is the element that will be 27 // replaced by this view. If you don't 28 // give it one, it will create one. 29 el: document.getElementByID('field'), 30 // use min/max length to set how many answers 31 // are required 32 minLength: 0, 33 maxLength: 10, 34 // class to set on input when input is valid 35 validClass: 'input-valid', // <- that's the default 36 // type value to use for the input tag's type value 37 type: 'text', 38 // class to set on input when input is valid 39 invalidClass: 'input-invalid', // <- that's the default 40 // Message to use if error is that it's required 41 // but no value was set. 42 requiredMessage: 'This field is required.', 43 // An array of test functions that each input must pass. 44 // They will be called in order with the current input value 45 // and you should write your test to return an error message 46 // if it fails and something falsey if it passes. 47 // Note that these tests get called with the field view instance as 48 // it's `this` context. 49 tests: [ 50 function (val) { 51 if (val.length < 5) return "Must be 5+ characters."; 52 } 53 ], 54 // optional, you can pass in the parent view explicitly 55 parent: someViewInstance 56}); 57 58// append it somewhere or use it in side an ampersand-form-view 59document.querySelector('form').appendChild(field.el); 60
Created by @HenrikJoreteg.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 5/20 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More