Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed Apr 24, 2017
1 parent 1a72c0e commit 7b4ee0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "async-validator",
"version": "1.6.8",
"version": "1.6.9",
"description": "validate form asynchronous",
"keywords": [
"validator",
Expand Down
19 changes: 8 additions & 11 deletions src/util.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
const formatRegExp = /%[sdj%]/g;

let warning2 = () => {
export let warning = () => {
};

// don't print warning message when in production env or node runtime
if (process.env.NODE_ENV !== 'production' && typeof global === 'undefined') {
warning2 = (type, message) => {
if (process.env.NODE_ENV !== 'production' &&
typeof window !== 'undefined' &&
typeof document !== 'undefined') {
warning = (type, errors) => {
if (typeof console !== 'undefined' && console.warn) {
console.warn(type, message);
if (errors.every(e => typeof e === 'string')) {
console.warn(type, errors);
}
}
};
}

export function warning(type, errors) {
// only warn native warning, default type is string, confuses many people...
if (errors.every(e => typeof e === 'string')) {
warning2(type, errors);
}
}

export function format(...args) {
let i = 1;
const f = args[0];
Expand Down

0 comments on commit 7b4ee0a

Please sign in to comment.