Skip to content

Commit

Permalink
rename typeof to type
Browse files Browse the repository at this point in the history
  • Loading branch information
yoiang committed Jan 24, 2018
1 parent 10e3f93 commit c08ab20
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
16 changes: 8 additions & 8 deletions dist/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var isString = exports.isString = function isString(value) {
if (typeof value === 'string' || value instanceof String) {
return {
value: value,
typeof: 'string'
type: 'string'
};
}
return false;
Expand All @@ -22,7 +22,7 @@ var isNumber = exports.isNumber = function isNumber(value) {
if (typeof value === 'number' && isFinite(value)) {
return {
value: value,
typeof: 'number'
type: 'number'
};
}
return false;
Expand All @@ -33,7 +33,7 @@ var isArray = exports.isArray = function isArray(value) {
if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.constructor === Array) {
return {
value: value,
typeof: 'array'
type: 'array'
};
}
return false;
Expand All @@ -44,7 +44,7 @@ var isObject = exports.isObject = function isObject(value) {
if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.constructor === Object) {
return {
value: value,
typeof: 'object'
type: 'object'
};
}
return false;
Expand All @@ -55,7 +55,7 @@ var isNull = exports.isNull = function isNull(value) {
if (value === null) {
return {
value: value,
typeof: 'null'
type: 'null'
};
}
return false;
Expand All @@ -66,7 +66,7 @@ var isUndefined = exports.isUndefined = function isUndefined(value) {
if (typeof value === 'undefined') {
return {
value: value,
typeof: 'undefined'
type: 'undefined'
};
}
return false;
Expand All @@ -77,7 +77,7 @@ var isBoolean = exports.isBoolean = function isBoolean(value) {
if (typeof value === 'boolean') {
return {
value: value,
typeof: 'boolean'
type: 'boolean'
};
}
return false;
Expand All @@ -88,7 +88,7 @@ var isDate = exports.isDate = function isDate(value) {
if (value instanceof Date) {
return {
value: value,
typeof: 'date'
type: 'date'
};
}
return false;
Expand Down
18 changes: 9 additions & 9 deletions dist/types.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export type ValueDescription = {
value: any,
typeof: string
type: string
}

export type ValidationResult = ValueDescription | false;
Expand All @@ -12,7 +12,7 @@ export const isString = (value: any): ValidationResult => {
if (typeof value === 'string' || value instanceof String) {
return {
value,
typeof: 'string'
type: 'string'
}
}
return false
Expand All @@ -23,7 +23,7 @@ export const isNumber = (value: any): ValidationResult => {
if (typeof value === 'number' && isFinite(value)) {
return {
value,
typeof: 'number'
type: 'number'
}
}
return false
Expand All @@ -34,7 +34,7 @@ export const isArray = (value: any): ValidationResult => {
if (value && typeof value === 'object' && value.constructor === Array) {
return {
value,
typeof: 'array'
type: 'array'
}
}
return false
Expand All @@ -45,7 +45,7 @@ export const isObject = (value: any): ValidationResult => {
if (value && typeof value === 'object' && value.constructor === Object) {
return {
value,
typeof: 'object'
type: 'object'
}
}
return false
Expand All @@ -56,7 +56,7 @@ export const isNull = (value: any): ValidationResult => {
if (value === null) {
return {
value,
typeof: 'null'
type: 'null'
}
}
return false
Expand All @@ -67,7 +67,7 @@ export const isUndefined = (value: any): ValidationResult => {
if (typeof value === 'undefined') {
return {
value,
typeof: 'undefined'
type: 'undefined'
}
}
return false
Expand All @@ -78,7 +78,7 @@ export const isBoolean = (value: any): ValidationResult => {
if (typeof value === 'boolean') {
return {
value,
typeof: 'boolean'
type: 'boolean'
}
}
return false
Expand All @@ -89,7 +89,7 @@ export const isDate = (value: any): ValidationResult => {
if (value instanceof Date) {
return {
value,
typeof: 'date'
type: 'date'
}
}
return false
Expand Down
18 changes: 9 additions & 9 deletions lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export type ValueDescription = {
value: any,
typeof: string
type: string
}

export type ValidationResult = ValueDescription | false;
Expand All @@ -12,7 +12,7 @@ export const isString = (value: any): ValidationResult => {
if (typeof value === 'string' || value instanceof String) {
return {
value,
typeof: 'string'
type: 'string'
}
}
return false
Expand All @@ -23,7 +23,7 @@ export const isNumber = (value: any): ValidationResult => {
if (typeof value === 'number' && isFinite(value)) {
return {
value,
typeof: 'number'
type: 'number'
}
}
return false
Expand All @@ -34,7 +34,7 @@ export const isArray = (value: any): ValidationResult => {
if (value && typeof value === 'object' && value.constructor === Array) {
return {
value,
typeof: 'array'
type: 'array'
}
}
return false
Expand All @@ -45,7 +45,7 @@ export const isObject = (value: any): ValidationResult => {
if (value && typeof value === 'object' && value.constructor === Object) {
return {
value,
typeof: 'object'
type: 'object'
}
}
return false
Expand All @@ -56,7 +56,7 @@ export const isNull = (value: any): ValidationResult => {
if (value === null) {
return {
value,
typeof: 'null'
type: 'null'
}
}
return false
Expand All @@ -67,7 +67,7 @@ export const isUndefined = (value: any): ValidationResult => {
if (typeof value === 'undefined') {
return {
value,
typeof: 'undefined'
type: 'undefined'
}
}
return false
Expand All @@ -78,7 +78,7 @@ export const isBoolean = (value: any): ValidationResult => {
if (typeof value === 'boolean') {
return {
value,
typeof: 'boolean'
type: 'boolean'
}
}
return false
Expand All @@ -89,7 +89,7 @@ export const isDate = (value: any): ValidationResult => {
if (value instanceof Date) {
return {
value,
typeof: 'date'
type: 'date'
}
}
return false
Expand Down

0 comments on commit c08ab20

Please sign in to comment.