Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isArray(value)) {
isValid = true;
}
break;
case 'object':
if (isObject(value)) {
isValid = true;
}
break;
case 'boolean':
if (isBoolean(value)) {
isValid = true;
}
break;
case 'null':
if (isNull(value)) {
isValid = true;
}
break;
case 'file':
// primitive typeには含まれないが`file`もサポートする。
if (!!value && isString(value.name)) {
isValid = true;
}
break;
default:
break;
}
});
if (!isValid) {
const normalizeHexValue = value => {
value = value.replace(/ /g, ' '); // eslint-disable-line no-irregular-whitespace
if (isNull(value)) {
return value;
}
if (isUndefined(value)) {
return null;
}
// 正しいフォーマットだがシャープをつけていない場合、頭にシャープをつける
if (isHex(value)) {
value = concatenatePoundKey(value);
}
// HEXでなければ変更前の文字列に戻す
if (!isTypingHex(value)) {
value = this.opts.color.value;
}
const renderHtml = data => {
let ret = '';
// nullの場合
if (isNull(data)) {
ret = `<div class="${BlockName}__null">null</div>`;
return ret;
}
// undefinedの場合
if (isUndefined(data)) {
ret = `<div class="${BlockName}__undefined">undefined</div>`;
return ret;
}
// 関数の場合
if (isFunction(data)) {
ret = `<div class="${BlockName}__function">f()</div>`;
return ret;
}
const fetchAutocompleteOptions = val => {
if (isNull(val) || isUndefined(val)) {
return;
}
Promise
.resolve()
.then(() => store.action('oas.getAutocomplete', path, ObjectAssign({}, query, {
[field]: val
})))
.then(options => {
this.options = options;
this.update();
})
.catch(err => store.action('modals.add', 'viron-error', {
error: err
}));
};
const increment = () => {
const currentValue = this.normalizeValue(this.opts.number);
const n = isNumber(step) ? step : 1;
let newValue;
if (isNull(currentValue)) {
newValue = n;
} else {
newValue = currentValue + n;
}
return this.normalizeValue(newValue);
};
this.handleBlockerTap = e => {
e.stopPropagation();
if (this.isMobile || !isClipboardCopySupported) {
return;
}
const target = find(this.opts.options || [], { isSelected: true });
const val = target && target.value;
if (isUndefined(val) || isNull(val)) {
return;
}
Promise
.resolve()
.then(() => {
return clipboard.copy(String(val));
})
.then(() => store.action('toasts.add', {
message: 'クリップボードへコピーしました。'
}))
.catch(() => {
isClipboardCopySupported = false;
store.action('toasts.add', {
type: 'error',
message: 'ご使用中のブラウザではクリップボードへコピー出来ませんでした。'
});
const concatenatePoundKey = value => {
const isIncludeSharp = value.match('^#');
if (isNull(isIncludeSharp)) {
value = `#${value}`;
}
return value;
};
const fetchAutocompleteOptions = val => {
if (isNull(val) || isUndefined(val)) {
return;
}
Promise
.resolve()
.then(() => store.action('oas.getAutocomplete', path, ObjectAssign({}, query, {
[field]: val
})))
.then(options => {
this.options = options;
this.update();
})
.catch(err => store.action('modals.add', 'viron-message', {
error: err
}));
};