UNPKG

api-console-assets

Version:

This repo only exists to publish api console components to npm

49 lines (37 loc) 880 B
<!-- @license Copyright 2017 Mulesoft. All rights reserved. --> <link rel="import" href="../../polymer/polymer.html"> <link rel="import" href="../../iron-validator-behavior/iron-validator-behavior.html"> <script> Polymer({ is: 'minimum-length', behaviors: [ Polymer.IronValidatorBehavior ], properties: { message: { type: String, value: 'At least 4 characters are required' } }, validateObject: function(obj) { for (var key in obj) { if (obj[key].length < 4) { return false; } } return true; }, validate: function(values) { if (typeof values === 'object') { return this.validateObject(values); } else { var value = Array.isArray(values) ? values.join('') : values; return value.length >= 4; } } }); </script>