Skip to content

Commit

Permalink
update module output
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoLockLock committed Feb 9, 2018
1 parent 03b5b77 commit d10d6ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export interface ValidateFn {
}


const isObject = (value) => value != null && typeof value === 'object' && Array.isArray(value) === false
const isObject = value => value != null && typeof value === 'object' && Array.isArray(value) === false

const isArray = (value) => Array.isArray(value)
const isArray = value => Array.isArray(value)

const isNumber = value => typeof value === 'number' && !isNaN(value)

Expand All @@ -34,7 +34,7 @@ const isString = value => typeof value === 'string'

const isAny = value => true

export const OBJECT = 'Object',
const OBJECT = 'Object',
ARRAY = "Array",
NUMBER = "Number",
BOOLEAN = "Boolean",
Expand Down Expand Up @@ -186,7 +186,7 @@ const getArraySafeValue: GetSafeValueFn = (params) => {
}
}

const getSafeValue: GetSafeValueFn = (params) => {
export const getSafeValue: GetSafeValueFn = (params) => {

const { value, model, onError = defaultErrorHandle, paths = ["VALUE"] } = params

Expand Down Expand Up @@ -221,13 +221,16 @@ const getSafeValue: GetSafeValueFn = (params) => {
}


export default getSafeValue

export const Type = {
[OBJECT]: OBJECT,
[ARRAY]: ARRAY,
[NUMBER]: NUMBER,
[BOOLEAN]: BOOLEAN,
[STRING]: STRING,
[ANY]: ANY
}

export default {
Type,
getSafeValue
}
2 changes: 1 addition & 1 deletion src/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getSafeValue, { Type, GetSafeValueFnModel } from '../index'
import { Type, GetSafeValueFnModel, getSafeValue } from '../index'
import * as chai from 'chai'

const { expect } = chai
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'build.min': ['./src/index.ts']
},
output: {
libraryTarget: "umd",
filename: './dist/[name].js'
},
plugins: [
Expand Down

0 comments on commit d10d6ea

Please sign in to comment.