Browse Source

Merge pull request #5172 from wenzhixin/fix/5171

check if the given value is a string or not
文翼 5 years ago
parent
commit
b4479e7e5e
2 changed files with 7 additions and 4 deletions
  1. 2 2
      .travis.yml
  2. 5 2
      src/utils/index.js

+ 2 - 2
.travis.yml

@@ -9,10 +9,10 @@ jobs:
       node_js:
       node_js:
         - 12
         - 12
       name: "Lint src and check docs"
       name: "Lint src and check docs"
-      before_install:
+      script:
         - cd tools
         - cd tools
         - git clone --depth=1 https://github.com/wenzhixin/bootstrap-table-examples
         - git clone --depth=1 https://github.com/wenzhixin/bootstrap-table-examples
-      script: npm run pre-commit
+        - npm run pre-commit
       if: branch != master AND type = pull_request
       if: branch != master AND type = pull_request
 
 
     - stage: deploy
     - stage: deploy

+ 5 - 2
src/utils/index.js

@@ -76,8 +76,11 @@ export default {
     }
     }
   },
   },
 
 
-  normalizeAccent (string) {
-    return string.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
+  normalizeAccent (value) {
+    if (typeof value !== 'string') {
+      return value
+    }
+    return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
   },
   },
 
 
   updateFieldGroup (columns) {
   updateFieldGroup (columns) {