customs.js
Advanced tools
+155
-191
@@ -28,9 +28,5 @@ <?xml version="1.0" encoding="UTF-8"?> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="31" column="35" selection-start-line="31" selection-start-column="35" selection-end-line="31" selection-end-column="35" /> | ||
| <caret line="12" column="33" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="33" /> | ||
| <folding> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| <marker date="1463094697000" expanded="true" signature="464:761" placeholder="/** @global ...*/" /> | ||
| <marker date="1463094697000" expanded="true" signature="785:850" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4210" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4318" placeholder="{...}" /> | ||
| </folding> | ||
@@ -41,7 +37,7 @@ </state> | ||
| </file> | ||
| <file leaf-file-name="package.json" pinned="false" current-in-tab="true"> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <file leaf-file-name="customs.js" pinned="false" current-in-tab="true"> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.41860464"> | ||
| <caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" /> | ||
| <state vertical-scroll-proportion="0.3125"> | ||
| <caret line="52" column="2" selection-start-line="52" selection-start-column="2" selection-end-line="52" selection-end-column="2" /> | ||
| <folding /> | ||
@@ -65,8 +61,9 @@ </state> | ||
| <list> | ||
| <option value="$PROJECT_DIR$/test/customs.js" /> | ||
| <option value="$PROJECT_DIR$/src/utils.js" /> | ||
| <option value="$PROJECT_DIR$/test/exam.js" /> | ||
| <option value="$PROJECT_DIR$/src/checks.js" /> | ||
| <option value="$PROJECT_DIR$/package.json" /> | ||
| <option value="$PROJECT_DIR$/test/customs.js" /> | ||
| <option value="$PROJECT_DIR$/src/exam.js" /> | ||
| <option value="$PROJECT_DIR$/package.json" /> | ||
| <option value="$PROJECT_DIR$/src/customs.js" /> | ||
| </list> | ||
@@ -299,3 +296,3 @@ </option> | ||
| <component name="ProjectFrameBounds"> | ||
| <option name="x" value="323" /> | ||
| <option name="x" value="158" /> | ||
| <option name="y" value="23" /> | ||
@@ -330,3 +327,3 @@ <option name="width" value="1068" /> | ||
| <panes> | ||
| <pane id="Scope" /> | ||
| <pane id="Scratches" /> | ||
| <pane id="ProjectPane"> | ||
@@ -422,3 +419,3 @@ <subPane> | ||
| </pane> | ||
| <pane id="Scratches" /> | ||
| <pane id="Scope" /> | ||
| </panes> | ||
@@ -440,119 +437,9 @@ </component> | ||
| </component> | ||
| <component name="RestoreUpdateTree" date="Moments ago" ActionInfo="_Update"> | ||
| <UpdatedFiles> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Updated from server" /> | ||
| <option name="myStatusName" value="Changed on server" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="CHANGED_ON_SERVER" /> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Updated" /> | ||
| <option name="myStatusName" value="Changed" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="UPDATED" /> | ||
| <PATH vcs="Git" revision="">$PROJECT_DIR$/src/checks.js</PATH> | ||
| <PATH vcs="Git" revision="">$PROJECT_DIR$/src/exam.js</PATH> | ||
| <PATH vcs="Git" revision="">$PROJECT_DIR$/src/utils.js</PATH> | ||
| <PATH vcs="Git" revision="">$PROJECT_DIR$/test/exam.js</PATH> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Created" /> | ||
| <option name="myStatusName" value="Created" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="CREATED" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Deleted" /> | ||
| <option name="myStatusName" value="Deleted" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="true" /> | ||
| <option name="myId" value="REMOVED_FROM_REPOSITORY" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Restored" /> | ||
| <option name="myStatusName" value="Will be restored" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="RESTORED" /> | ||
| </FILE-GROUP> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Modified" /> | ||
| <option name="myStatusName" value="Modified" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="MODIFIED" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Skipped" /> | ||
| <option name="myStatusName" value="Skipped" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="SKIPPED" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Merged with conflicts" /> | ||
| <option name="myStatusName" value="Will be merged with conflicts" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="MERGED_WITH_CONFLICTS" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Merged with tree conflicts" /> | ||
| <option name="myStatusName" value="Merged with tree conflicts" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="MERGED_WITH_TREE_CONFLICT" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Merged with property conflicts" /> | ||
| <option name="myStatusName" value="Will be merged with property conflicts" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="MERGED_WITH_PROPERTY_CONFLICT" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Merged" /> | ||
| <option name="myStatusName" value="Will be merged" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="MERGED" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Not in repository" /> | ||
| <option name="myStatusName" value="Not in repository" /> | ||
| <option name="mySupportsDeletion" value="true" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="UNKNOWN" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Locally added" /> | ||
| <option name="myStatusName" value="Locally added" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="LOCALLY_ADDED" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Locally removed" /> | ||
| <option name="myStatusName" value="Locally removed" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="LOCALLY_REMOVED" /> | ||
| </FILE-GROUP> | ||
| <FILE-GROUP> | ||
| <option name="myUpdateName" value="Switched" /> | ||
| <option name="myStatusName" value="Switched" /> | ||
| <option name="mySupportsDeletion" value="false" /> | ||
| <option name="myCanBeAbsent" value="false" /> | ||
| <option name="myId" value="SWITCHED" /> | ||
| </FILE-GROUP> | ||
| </UpdatedFiles> | ||
| </component> | ||
| <component name="RunManager" selected="Grunt.js.build"> | ||
| <component name="RunManager" selected="Grunt.js.Dev"> | ||
| <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application"> | ||
| <method /> | ||
| </configuration> | ||
| <configuration default="true" type="DartTestRunConfigurationType" factoryName="Dart Test"> | ||
| <method /> | ||
| </configuration> | ||
| <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file=""> | ||
@@ -706,10 +593,34 @@ <envs /> | ||
| </task> | ||
| <option name="localTasksCounter" value="8" /> | ||
| <task id="LOCAL-00008" summary="Allowing for extensibility to the check rules "> | ||
| <created>1468283975316</created> | ||
| <option name="number" value="00008" /> | ||
| <option name="project" value="LOCAL" /> | ||
| <updated>1468283975316</updated> | ||
| </task> | ||
| <task id="LOCAL-00009" summary="Collapse this commit # Merge remote-tracking branch 'origin/extensiblecheck' into extensiblecheck # Conflicts: #	test/customs.js "> | ||
| <created>1468294327509</created> | ||
| <option name="number" value="00009" /> | ||
| <option name="project" value="LOCAL" /> | ||
| <updated>1468294327509</updated> | ||
| </task> | ||
| <task id="LOCAL-00010" summary="Collapse this commit # Merge remote-tracking branch 'origin/extensiblecheck' into extensiblecheck # Conflicts: #	test/customs.js "> | ||
| <created>1468294440421</created> | ||
| <option name="number" value="00010" /> | ||
| <option name="project" value="LOCAL" /> | ||
| <updated>1468294440421</updated> | ||
| </task> | ||
| <task id="LOCAL-00011" summary="Functionality to extend the runtime validation rules "> | ||
| <created>1468350216158</created> | ||
| <option name="number" value="00011" /> | ||
| <option name="project" value="LOCAL" /> | ||
| <updated>1468350216158</updated> | ||
| </task> | ||
| <option name="localTasksCounter" value="12" /> | ||
| <servers /> | ||
| </component> | ||
| <component name="ToolWindowManager"> | ||
| <frame x="323" y="23" width="1068" height="981" extended-state="0" /> | ||
| <frame x="158" y="23" width="1068" height="981" extended-state="0" /> | ||
| <editor active="true" /> | ||
| <layout> | ||
| <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17041199" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> | ||
| <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17000955" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> | ||
| <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> | ||
@@ -720,6 +631,8 @@ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> | ||
| <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32894737" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32772166" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.121484816" sideWeight="0.4979827" order="2" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24928367" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> | ||
| <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> | ||
@@ -729,7 +642,5 @@ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.12230216" sideWeight="0.4979827" order="2" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> | ||
| <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32894737" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | ||
| <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> | ||
| </layout> | ||
@@ -754,3 +665,7 @@ </component> | ||
| <MESSAGE value="v0.5.0" /> | ||
| <option name="LAST_COMMIT_MESSAGE" value="v0.5.0" /> | ||
| <MESSAGE value="Allowing for extensibility to the check rules " /> | ||
| <MESSAGE value="Merge remote-tracking branch 'origin/extensiblecheck' into extensiblecheck # Conflicts: #	test/customs.js " /> | ||
| <MESSAGE value="Collapse this commit # Merge remote-tracking branch 'origin/extensiblecheck' into extensiblecheck # Conflicts: #	test/customs.js " /> | ||
| <MESSAGE value="Functionality to extend the runtime validation rules " /> | ||
| <option name="LAST_COMMIT_MESSAGE" value="Functionality to extend the runtime validation rules " /> | ||
| </component> | ||
@@ -765,9 +680,5 @@ <component name="XDebuggerManager"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | ||
| <caret line="27" column="11" selection-start-line="27" selection-start-column="11" selection-end-line="27" selection-end-column="11" /> | ||
| <folding> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| <marker date="1463094697000" expanded="true" signature="464:761" placeholder="/** @global ...*/" /> | ||
| <marker date="1463094697000" expanded="true" signature="785:850" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4210" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4318" placeholder="{...}" /> | ||
| </folding> | ||
@@ -777,6 +688,46 @@ </state> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="16" column="32" selection-start-line="16" selection-start-column="32" selection-end-line="16" selection-end-column="32" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/test/checks.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/test/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="8" column="15" selection-start-line="8" selection-start-column="15" selection-end-line="8" selection-end-column="15" /> | ||
| <caret line="78" column="2" selection-start-line="78" selection-start-column="2" selection-end-line="78" selection-end-column="2" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/test/exam.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="78" column="10" selection-start-line="78" selection-start-column="10" selection-end-line="78" selection-end-column="10" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/exam.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="31" column="35" selection-start-line="31" selection-start-column="35" selection-end-line="31" selection-end-column="35" /> | ||
| <folding> | ||
@@ -788,6 +739,14 @@ <element signature="n#!!doc" expanded="true" /> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="8" column="15" selection-start-line="8" selection-start-column="15" selection-end-line="8" selection-end-column="15" /> | ||
| <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/exam.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | ||
| <folding> | ||
@@ -799,2 +758,18 @@ <element signature="n#!!doc" expanded="true" /> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="8" column="15" selection-start-line="8" selection-start-column="15" selection-end-line="8" selection-end-column="15" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="8" column="15" selection-start-line="8" selection-start-column="15" selection-end-line="8" selection-end-column="15" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/checks.js"> | ||
@@ -804,5 +779,2 @@ <provider selected="true" editor-type-id="text-editor"> | ||
| <caret line="66" column="0" selection-start-line="66" selection-start-column="0" selection-end-line="66" selection-end-column="0" /> | ||
| <folding> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| </folding> | ||
| </state> | ||
@@ -845,6 +817,2 @@ </provider> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| <marker date="1463094697000" expanded="true" signature="464:761" placeholder="/** @global ...*/" /> | ||
| <marker date="1463094697000" expanded="true" signature="785:850" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4210" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4318" placeholder="{...}" /> | ||
| </folding> | ||
@@ -861,9 +829,2 @@ </state> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/test/checks.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/node_modules/proclaim/lib/proclaim.js"> | ||
@@ -883,44 +844,45 @@ <provider selected="true" editor-type-id="text-editor"> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/test/customs.js"> | ||
| <entry file="file://$PROJECT_DIR$/node_modules/utl.js/src/isEmpty.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="4.1358695"> | ||
| <caret line="205" column="3" selection-start-line="205" selection-start-column="3" selection-end-line="205" selection-end-column="3" /> | ||
| <state vertical-scroll-proportion="0.26291513"> | ||
| <caret line="19" column="22" selection-start-line="19" selection-start-column="15" selection-end-line="19" selection-end-column="22" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/test/exam.js"> | ||
| <entry file="file://$PROJECT_DIR$/build/modules.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.44372693"> | ||
| <caret line="78" column="10" selection-start-line="78" selection-start-column="10" selection-end-line="78" selection-end-column="10" /> | ||
| <state vertical-scroll-proportion="0.056603774"> | ||
| <caret line="4" column="1" selection-start-line="4" selection-start-column="1" selection-end-line="4" selection-end-column="1" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/utils.js"> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.12453874"> | ||
| <caret line="11" column="35" selection-start-line="11" selection-start-column="23" selection-end-line="11" selection-end-column="35" /> | ||
| <state vertical-scroll-proportion="0.28503564"> | ||
| <caret line="16" column="32" selection-start-line="16" selection-start-column="32" selection-end-line="16" selection-end-column="32" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/node_modules/utl.js/src/isEmpty.js"> | ||
| <entry file="file://$PROJECT_DIR$/test/checks.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.26291513"> | ||
| <caret line="19" column="22" selection-start-line="19" selection-start-column="15" selection-end-line="19" selection-end-column="22" /> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="15" column="80" selection-start-line="15" selection-start-column="80" selection-end-line="15" selection-end-column="80" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/build/modules.json"> | ||
| <entry file="file://$PROJECT_DIR$/test/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.056603774"> | ||
| <caret line="4" column="1" selection-start-line="4" selection-start-column="1" selection-end-line="4" selection-end-column="1" /> | ||
| <state vertical-scroll-proportion="3.4468822"> | ||
| <caret line="201" column="0" selection-start-line="201" selection-start-column="0" selection-end-line="201" selection-end-column="0" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <entry file="file://$PROJECT_DIR$/test/exam.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.013837638"> | ||
| <caret line="8" column="15" selection-start-line="8" selection-start-column="15" selection-end-line="8" selection-end-column="15" /> | ||
| <folding> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| </folding> | ||
| <state vertical-scroll-proportion="0.017321017"> | ||
| <caret line="78" column="10" selection-start-line="78" selection-start-column="10" selection-end-line="78" selection-end-column="10" /> | ||
| <folding /> | ||
| </state> | ||
@@ -932,9 +894,5 @@ </provider> | ||
| <state vertical-scroll-proportion="0.0"> | ||
| <caret line="31" column="35" selection-start-line="31" selection-start-column="35" selection-end-line="31" selection-end-column="35" /> | ||
| <caret line="12" column="33" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="33" /> | ||
| <folding> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| <marker date="1463094697000" expanded="true" signature="464:761" placeholder="/** @global ...*/" /> | ||
| <marker date="1463094697000" expanded="true" signature="785:850" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4210" placeholder="{...}" /> | ||
| <marker date="1463094697000" expanded="true" signature="4205:4318" placeholder="{...}" /> | ||
| </folding> | ||
@@ -944,16 +902,22 @@ </state> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/utils.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.15588914"> | ||
| <caret line="11" column="35" selection-start-line="11" selection-start-column="23" selection-end-line="11" selection-end-column="35" /> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/src/checks.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.39366516"> | ||
| <state vertical-scroll-proportion="1.2644342"> | ||
| <caret line="75" column="33" selection-start-line="75" selection-start-column="33" selection-end-line="75" selection-end-column="33" /> | ||
| <folding> | ||
| <element signature="n#!!doc" expanded="true" /> | ||
| </folding> | ||
| <folding /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <entry file="file://$PROJECT_DIR$/src/customs.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state vertical-scroll-proportion="0.41860464"> | ||
| <caret line="24" column="4" selection-start-line="24" selection-start-column="4" selection-end-line="24" selection-end-column="4" /> | ||
| <state vertical-scroll-proportion="0.3125"> | ||
| <caret line="52" column="2" selection-start-line="52" selection-start-column="2" selection-end-line="52" selection-end-column="2" /> | ||
| <folding /> | ||
@@ -960,0 +924,0 @@ </state> |
@@ -159,2 +159,11 @@ /*! | ||
| // returns false if value contains anything other than alphanumeric characters, | ||
| // underscores, or dashes. | ||
| checks['numericDash'] = { | ||
| 'msg': 'The {0} field must only contain alpha-numeric characters, underscores, and dashes.', | ||
| 'check': function (val) { | ||
| return regExs['numericDash'].test(val); | ||
| } | ||
| }; | ||
| // returns false if the value contains anything other than an integer. | ||
@@ -161,0 +170,0 @@ checks['integer'] = { |
+15
-1
@@ -13,2 +13,3 @@ /*! | ||
| var Exam = require('./exam'); | ||
| var checks = require('./checks'); | ||
@@ -46,6 +47,19 @@ | ||
| * | ||
| * @desc Enter a customized check to the runtime rules hash | ||
| * | ||
| * @param {string} name - name of the new check | ||
| * @param {object} opts - custom check logic | ||
| */ | ||
| Customs.prototype.appendCheck = function (name, opts) { | ||
| checks[name] = opts; | ||
| }; | ||
| /** | ||
| * @public | ||
| * @memberof Customs | ||
| * | ||
| * @desc Run exam and return result object. | ||
| * | ||
| * @param {object} data - data to validate. | ||
| * @returns {object} - result (isValid and erors properties). | ||
| * @returns {object} - result (isValid and errors properties). | ||
| */ | ||
@@ -52,0 +66,0 @@ Customs.prototype.check = function (data) { |
@@ -159,2 +159,11 @@ /*! | ||
| // returns false if value contains anything other than alphanumeric characters, | ||
| // underscores, or dashes. | ||
| checks['numericDash'] = { | ||
| 'msg': 'The {0} field must only contain alpha-numeric characters, underscores, and dashes.', | ||
| 'check': function (val) { | ||
| return regExs['numericDash'].test(val); | ||
| } | ||
| }; | ||
| // returns false if the value contains anything other than an integer. | ||
@@ -161,0 +170,0 @@ checks['integer'] = { |
@@ -13,2 +13,3 @@ /*! | ||
| var Exam = require('./exam'); | ||
| var checks = require('./checks'); | ||
@@ -46,6 +47,19 @@ | ||
| * | ||
| * @desc Enter a customized check to the runtime rules hash | ||
| * | ||
| * @param {string} name - name of the new check | ||
| * @param {object} opts - custom check logic | ||
| */ | ||
| Customs.prototype.appendCheck = function (name, opts) { | ||
| checks[name] = opts; | ||
| }; | ||
| /** | ||
| * @public | ||
| * @memberof Customs | ||
| * | ||
| * @desc Run exam and return result object. | ||
| * | ||
| * @param {object} data - data to validate. | ||
| * @returns {object} - result (isValid and erors properties). | ||
| * @returns {object} - result (isValid and errors properties). | ||
| */ | ||
@@ -52,0 +66,0 @@ Customs.prototype.check = function (data) { |
+22
-1
@@ -241,2 +241,10 @@ (function (root, factory) { | ||
| }; | ||
| // returns false if value contains anything other than alphanumeric characters, | ||
| // underscores, or dashes. | ||
| checks['numericDash'] = { | ||
| 'msg': 'The {0} field must only contain alpha-numeric characters, underscores, and dashes.', | ||
| 'check': function (val) { | ||
| return regExs['numericDash'].test(val); | ||
| } | ||
| }; | ||
| // returns false if the value contains anything other than an integer. | ||
@@ -552,2 +560,3 @@ checks['integer'] = { | ||
| var Exam = _exam_; | ||
| var checks = _checks_; | ||
| /* ----------------------------------------------------------------------------- | ||
@@ -581,6 +590,18 @@ * Customs | ||
| * | ||
| * @desc Enter a customized check to the runtime rules hash | ||
| * | ||
| * @param {string} name - name of the new check | ||
| * @param {object} opts - custom check logic | ||
| */ | ||
| Customs.prototype.appendCheck = function (name, opts) { | ||
| checks[name] = opts; | ||
| }; | ||
| /** | ||
| * @public | ||
| * @memberof Customs | ||
| * | ||
| * @desc Run exam and return result object. | ||
| * | ||
| * @param {object} data - data to validate. | ||
| * @returns {object} - result (isValid and erors properties). | ||
| * @returns {object} - result (isValid and errors properties). | ||
| */ | ||
@@ -587,0 +608,0 @@ Customs.prototype.check = function (data) { |
@@ -1,1 +0,1 @@ | ||
| !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.returnExportsGlobal=b()}):"object"==typeof exports?module.exports=b():a.Customs=b()}(this,function(){var a,b,c,d,e,f,g,h;return a=function(a){return"[object Array]"===Object.prototype.toString.call(a)},b=function(a){return function(b){if(a(b))return 0===b.length;for(var c in b)if(b.hasOwnProperty(c))return!1;return!0}}(a),c=function(a,b){return a.replace(/{([^{}]*)}/g,function(a,c){return"string"==typeof b[c]?b[c]:a})},d=function(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])a[c]=arguments[b][c];return a},e=function(a){var e=b,f=c,g=d;return{isEmpty:e,tmpl:f,extend:g,createListParser:function(a){var b=this;return function(){return b.listParser.apply(a,arguments)}},listParser:function(a){for(var b=a.split(","),c=0;c<b.length;c++){var d=String(b[c]).replace(/^\s+|\s+$/g,"");if(!this.regex.test(d))return!1}return!0}}}({}),g=function(a){var b=e,c={numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,email:/^[a-zA-Z0-9.!#$%&'*+\-\/=?\^_`{|}~\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_\-]+$/i,natural:/^[0-9]+$/i,naturalNoZero:/^[1-9][0-9]*$/i,ip:/^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i,base64:/[^a-zA-Z0-9\/\+=]/i,numericDash:/^[\d\-\s]+$/,url:/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i},d={};d.required={msg:"The {0} field is required.",check:function(a){return null!==a&&"object"==typeof a?!b.isEmpty(a):null!==a&&""!==a}},d["default"]={msg:"The {0} field is still set to default, please change.",check:function(a,b){return a!==b}},d.and={msg:"The {0} field needs to validate all fields in the {1} group.",check:function(){return!0}},d.email={msg:"The {0} field must contain a valid email address.",check:function(a){return c.email.test(a)}},d.minLength={msg:"The {0} field must be at least {1} characters in length.",check:function(a,b){return c.numeric.test(b)?a.length>=parseInt(b,10):!1}},d.maxLength={msg:"The {0} field must not exceed {1} characters in length.",check:function(a,b){return c.numeric.test(b)?a.length<=parseInt(b,10):!1}},d.exactLength={msg:"The {0} field must be exactly {1} characters in length.",check:function(a,b){return c.numeric.test(b)?a.length===parseInt(b,10):!1}},d.greaterThan={msg:"The {0} field must contain a number greater than {1}.",check:function(a,b){return c.decimal.test(a)?parseFloat(a)>parseFloat(b):!1}},d.lessThan={msg:"The {0} field must contain a number less than {1}.",check:function(a,b){return c.decimal.test(a)?parseFloat(a)<parseFloat(b):!1}},d.alpha={msg:"The {0} field must only contain alphabetical characters.",check:function(a){return c.alpha.test(a)}},d.alphaNumeric={msg:"The {0} field must only contain alpha-numeric characters.",check:function(a){return c.alphaNumeric.test(a)}},d.alphaDash={msg:"The {0} field must only contain alpha-numeric characters, underscores, and dashes.",check:function(a){return c.alphaDash.test(a)}},d.numeric={msg:"The {0} field must contain only numbers.",check:function(a){return c.numeric.test(a)}},d.integer={msg:"The {0} field must contain an integer.",check:function(a){return c.integer.test(a)}},d.decimal={msg:"The {0} field must contain a decimal number.",check:function(a){return c.decimal.test(a)}},d.natural={msg:"The {0} field must contain only positive numbers.",check:function(a){return c.natural.test(a)}},d.naturalNoZero={msg:"The {0} field must contain a number greater than zero.",check:function(a){return c.naturalNoZero.test(a)}},d.url={msg:"The {0} field must contain a valid URL.",check:function(a){return c.url.test(a)}},d.creditCard={msg:"The {0} field must contain a valid credit card number.",check:function(a){if(!c.numericDash.test(a))return!1;for(var b=a.replace(/[ -]+/g,""),d=b.length,e=0,f=0,g=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]];d--;)f+=g[e][parseInt(b.charAt(d),10)],e^=1;return f%10===0&&f>0}},d.fileType={msg:"The {0} field must contain only {1} files.",check:function(a,b){for(var c=a.substr(a.lastIndexOf(".")+1),d=b.split(","),e=0;e<d.length;e++){var f=String(d[e]).replace(/^\s+|\s+$/g,"");if(c===f)return!0}return!1}},d.equalTo={msg:"The value of {0} does not match the value of {1}.",check:function(a,b,c){return a===c[b]}};for(var f in c){var g=(c[f],f+"s");d[g]={msg:"The {0} field must contain all valid "+g+".",regex:c[f]},d[g].check=b.createListParser(d[g])}return d}({}),h=function(a){var b=e,c=g,d=function(){this.isValid=!0,this.errors={},this.andGroup={},this.andCounter={}};return d.prototype.run=function(a,b){for(var c in a)b[c]&&this.checkRules(c,a[c],b[c],a);for(var d in this.andGroup)this.checkGroups(this.andGroup[d],this.andCounter[d])},d.prototype.checkGroups=function(a,c){if(c.empty===c.count)for(var d in a){var e=a[d];delete this.errors[e]}b.isEmpty(this.errors)&&(this.isValid=!0)},d.prototype.checkRules=function(a,b,c,d){var e=[],f=""===b,g=c[0];if(f&&g&&"required"!==c[0].name)return!0;var h="";for(var i in c){var j=c[i];"default"===j.name&&(h=j.args)}for(i in c){var k=this.checkRule(a,b,c[i],d,h);k&&e.push(k)}e.length&&(this.errors[a]=e)},d.prototype.checkRule=function(a,b,d,e,f){if(!c[d.name])throw new Error("There is no check defined by the name: "+d.name);if("and"===d.name){var g=d.args,h=d.name+"Group",i=this[h][g]||[];i.push(a),this[h][g]=i,h=d.name+"Counter";var j=this[h][g]||{empty:0,count:0};b===f&&j.empty++,j.count++,this[h][g]=j}return c[d.name].check(b,d.args,e)?null:this.formatError(a,d)},d.prototype.formatError=function(a,d){this.isValid=!1;var e=c[d.name].msg,f=[a];return d.args&&(f=f.concat([d.args])),{name:d.name,msg:b.tmpl(e,f)}},d}({}),f=function(a){var b=h,c=function(a){this.rules=this.build(a)};return c.prototype.check=function(a){var c=new b;return c.run(a,this.rules||{}),{isValid:c.isValid,errors:c.errors}},c.prototype.build=function(a){var b={};for(var c in a)b[c]=this.buildRules(a[c]);return b},c.prototype.buildRules=function(a){for(var b=a.split("|"),c=[],d=0,e=b.length;e>d;d++){var f=this.parseRule(b[d]),g="required"===f.name?"unshift":"push";c[g](f)}return c},c.prototype.parseRule=function(a){var b=/^(.+?)\[(.+)\]$/.exec(a);return b?{name:b[1],args:b[2]}:{name:a}},c}({})}); | ||
| !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.returnExportsGlobal=b()}):"object"==typeof exports?module.exports=b():a.Customs=b()}(this,function(){var a,b,c,d,e,f,g,h;return a=function(a){return"[object Array]"===Object.prototype.toString.call(a)},b=function(a){return function(b){if(a(b))return 0===b.length;for(var c in b)if(b.hasOwnProperty(c))return!1;return!0}}(a),c=function(a,b){return a.replace(/{([^{}]*)}/g,function(a,c){return"string"==typeof b[c]?b[c]:a})},d=function(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])a[c]=arguments[b][c];return a},e=function(a){var e=b,f=c,g=d;return{isEmpty:e,tmpl:f,extend:g,createListParser:function(a){var b=this;return function(){return b.listParser.apply(a,arguments)}},listParser:function(a){for(var b=a.split(","),c=0;c<b.length;c++){var d=String(b[c]).replace(/^\s+|\s+$/g,"");if(!this.regex.test(d))return!1}return!0}}}({}),g=function(a){var b=e,c={numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,email:/^[a-zA-Z0-9.!#$%&'*+\-\/=?\^_`{|}~\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_\-]+$/i,natural:/^[0-9]+$/i,naturalNoZero:/^[1-9][0-9]*$/i,ip:/^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i,base64:/[^a-zA-Z0-9\/\+=]/i,numericDash:/^[\d\-\s]+$/,url:/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i},d={};d.required={msg:"The {0} field is required.",check:function(a){return null!==a&&"object"==typeof a?!b.isEmpty(a):null!==a&&""!==a}},d["default"]={msg:"The {0} field is still set to default, please change.",check:function(a,b){return a!==b}},d.and={msg:"The {0} field needs to validate all fields in the {1} group.",check:function(){return!0}},d.email={msg:"The {0} field must contain a valid email address.",check:function(a){return c.email.test(a)}},d.minLength={msg:"The {0} field must be at least {1} characters in length.",check:function(a,b){return c.numeric.test(b)?a.length>=parseInt(b,10):!1}},d.maxLength={msg:"The {0} field must not exceed {1} characters in length.",check:function(a,b){return c.numeric.test(b)?a.length<=parseInt(b,10):!1}},d.exactLength={msg:"The {0} field must be exactly {1} characters in length.",check:function(a,b){return c.numeric.test(b)?a.length===parseInt(b,10):!1}},d.greaterThan={msg:"The {0} field must contain a number greater than {1}.",check:function(a,b){return c.decimal.test(a)?parseFloat(a)>parseFloat(b):!1}},d.lessThan={msg:"The {0} field must contain a number less than {1}.",check:function(a,b){return c.decimal.test(a)?parseFloat(a)<parseFloat(b):!1}},d.alpha={msg:"The {0} field must only contain alphabetical characters.",check:function(a){return c.alpha.test(a)}},d.alphaNumeric={msg:"The {0} field must only contain alpha-numeric characters.",check:function(a){return c.alphaNumeric.test(a)}},d.alphaDash={msg:"The {0} field must only contain alpha-numeric characters, underscores, and dashes.",check:function(a){return c.alphaDash.test(a)}},d.numeric={msg:"The {0} field must contain only numbers.",check:function(a){return c.numeric.test(a)}},d.numericDash={msg:"The {0} field must only contain alpha-numeric characters, underscores, and dashes.",check:function(a){return c.numericDash.test(a)}},d.integer={msg:"The {0} field must contain an integer.",check:function(a){return c.integer.test(a)}},d.decimal={msg:"The {0} field must contain a decimal number.",check:function(a){return c.decimal.test(a)}},d.natural={msg:"The {0} field must contain only positive numbers.",check:function(a){return c.natural.test(a)}},d.naturalNoZero={msg:"The {0} field must contain a number greater than zero.",check:function(a){return c.naturalNoZero.test(a)}},d.url={msg:"The {0} field must contain a valid URL.",check:function(a){return c.url.test(a)}},d.creditCard={msg:"The {0} field must contain a valid credit card number.",check:function(a){if(!c.numericDash.test(a))return!1;for(var b=a.replace(/[ -]+/g,""),d=b.length,e=0,f=0,g=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]];d--;)f+=g[e][parseInt(b.charAt(d),10)],e^=1;return f%10===0&&f>0}},d.fileType={msg:"The {0} field must contain only {1} files.",check:function(a,b){for(var c=a.substr(a.lastIndexOf(".")+1),d=b.split(","),e=0;e<d.length;e++){var f=String(d[e]).replace(/^\s+|\s+$/g,"");if(c===f)return!0}return!1}},d.equalTo={msg:"The value of {0} does not match the value of {1}.",check:function(a,b,c){return a===c[b]}};for(var f in c){var g=(c[f],f+"s");d[g]={msg:"The {0} field must contain all valid "+g+".",regex:c[f]},d[g].check=b.createListParser(d[g])}return d}({}),h=function(a){var b=e,c=g,d=function(){this.isValid=!0,this.errors={},this.andGroup={},this.andCounter={}};return d.prototype.run=function(a,b){for(var c in a)b[c]&&this.checkRules(c,a[c],b[c],a);for(var d in this.andGroup)this.checkGroups(this.andGroup[d],this.andCounter[d])},d.prototype.checkGroups=function(a,c){if(c.empty===c.count)for(var d in a){var e=a[d];delete this.errors[e]}b.isEmpty(this.errors)&&(this.isValid=!0)},d.prototype.checkRules=function(a,b,c,d){var e=[],f=""===b,g=c[0];if(f&&g&&"required"!==c[0].name)return!0;var h="";for(var i in c){var j=c[i];"default"===j.name&&(h=j.args)}for(i in c){var k=this.checkRule(a,b,c[i],d,h);k&&e.push(k)}e.length&&(this.errors[a]=e)},d.prototype.checkRule=function(a,b,d,e,f){if(!c[d.name])throw new Error("There is no check defined by the name: "+d.name);if("and"===d.name){var g=d.args,h=d.name+"Group",i=this[h][g]||[];i.push(a),this[h][g]=i,h=d.name+"Counter";var j=this[h][g]||{empty:0,count:0};b===f&&j.empty++,j.count++,this[h][g]=j}return c[d.name].check(b,d.args,e)?null:this.formatError(a,d)},d.prototype.formatError=function(a,d){this.isValid=!1;var e=c[d.name].msg,f=[a];return d.args&&(f=f.concat([d.args])),{name:d.name,msg:b.tmpl(e,f)}},d}({}),f=function(a){var b=h,c=g,d=function(a){this.rules=this.build(a)};return d.prototype.appendCheck=function(a,b){c[a]=b},d.prototype.check=function(a){var c=new b;return c.run(a,this.rules||{}),{isValid:c.isValid,errors:c.errors}},d.prototype.build=function(a){var b={};for(var c in a)b[c]=this.buildRules(a[c]);return b},d.prototype.buildRules=function(a){for(var b=a.split("|"),c=[],d=0,e=b.length;e>d;d++){var f=this.parseRule(b[d]),g="required"===f.name?"unshift":"push";c[g](f)}return c},d.prototype.parseRule=function(a){var b=/^(.+?)\[(.+)\]$/.exec(a);return b?{name:b[1],args:b[2]}:{name:a}},d}({})}); |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "author": "Jarid Margolin <jarid@firstopinion.co>", | ||
| "version": "0.5.0", | ||
| "version": "0.6.0", | ||
| "homepage": "https://github.com/jaridmargolin/customs.js", | ||
@@ -8,0 +8,0 @@ "repository": { |
+9
-0
@@ -159,2 +159,11 @@ /*! | ||
| // returns false if value contains anything other than alphanumeric characters, | ||
| // underscores, or dashes. | ||
| checks['numericDash'] = { | ||
| 'msg': 'The {0} field must only contain alpha-numeric characters, underscores, and dashes.', | ||
| 'check': function (val) { | ||
| return regExs['numericDash'].test(val); | ||
| } | ||
| }; | ||
| // returns false if the value contains anything other than an integer. | ||
@@ -161,0 +170,0 @@ checks['integer'] = { |
+15
-1
@@ -13,2 +13,3 @@ /*! | ||
| var Exam = require('./exam'); | ||
| var checks = require('./checks'); | ||
@@ -46,6 +47,19 @@ | ||
| * | ||
| * @desc Enter a customized check to the runtime rules hash | ||
| * | ||
| * @param {string} name - name of the new check | ||
| * @param {object} opts - custom check logic | ||
| */ | ||
| Customs.prototype.appendCheck = function (name, opts) { | ||
| checks[name] = opts; | ||
| }; | ||
| /** | ||
| * @public | ||
| * @memberof Customs | ||
| * | ||
| * @desc Run exam and return result object. | ||
| * | ||
| * @param {object} data - data to validate. | ||
| * @returns {object} - result (isValid and erors properties). | ||
| * @returns {object} - result (isValid and errors properties). | ||
| */ | ||
@@ -52,0 +66,0 @@ Customs.prototype.check = function (data) { |
+35
-1
@@ -203,5 +203,39 @@ /*! | ||
| /* --------------------------------------------------------------------------- | ||
| * custom check | ||
| * -------------------------------------------------------------------------*/ | ||
| describe('binary check', function () { | ||
| beforeEach(function () { | ||
| this.customs = new Customs({ | ||
| 'bin': 'required|binary' | ||
| }); | ||
| this.customs.appendCheck('binary', { | ||
| 'msg': 'The {0} field must only contain 0 or 1, binary characters.', | ||
| 'check': function (val) { | ||
| return /\b[01]+\b/.test(val); | ||
| } | ||
| }); | ||
| }); | ||
| it('Should validate a custom binary string.', function () { | ||
| var result = this.customs.check({ 'bin': '1011' }); | ||
| assert.isTrue(result['isValid']); | ||
| }); | ||
| it('Should not validate a bad binary string.', function () { | ||
| var result = this.customs.check({ 'bin': '1223' }); | ||
| assert.isFalse(result['isValid']); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
173139
0.81%3175
3.56%0
-100%