├── .browserslistrc ├── .editorconfig ├── .github └── FUNDING.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── example ├── Error test file.csvx ├── Example # Delim.csv ├── Example - RFC.csv ├── Example RFC Complaint # Delim.csv ├── Example RFC Complaint.csv └── Example.csv ├── karma.conf.js ├── package.json ├── projects └── ngx-csv-parser │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ ├── _model │ │ │ ├── ngx-csv-parser-config.interface.ts │ │ │ └── ngx-csv-parser-error.interface.ts │ │ ├── ngx-csv-parser.component.spec.ts │ │ ├── ngx-csv-parser.component.ts │ │ ├── ngx-csv-parser.module.ts │ │ ├── ngx-csv-parser.service.spec.ts │ │ └── ngx-csv-parser.service.ts │ ├── public-api.ts │ └── test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ └── tslint.json ├── src ├── app │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ └── app.module.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.scss └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [tofiqquadri] 4 | patreon: tofiqquadri 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # cache 11 | .angular/cache/ 12 | 13 | # dependencies 14 | /node_modules 15 | 16 | # profiling files 17 | chrome-profiler-events.json 18 | speed-measure-plugin.json 19 | 20 | # IDEs and editors 21 | /.idea 22 | .project 23 | .classpath 24 | .c9/ 25 | *.launch 26 | .settings/ 27 | *.sublime-workspace 28 | 29 | # IDE - VSCode 30 | .vscode/* 31 | !.vscode/settings.json 32 | !.vscode/tasks.json 33 | !.vscode/launch.json 34 | !.vscode/extensions.json 35 | .history/* 36 | 37 | # misc 38 | /.sass-cache 39 | /connect.lock 40 | /coverage 41 | /libpeerconnection.log 42 | npm-debug.log 43 | yarn-error.log 44 | testem.log 45 | /typings 46 | 47 | # System Files 48 | .DS_Store 49 | Thumbs.db 50 | 51 | # Package lock 52 | package-lock.json -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | tailwind.config.js 25 | 26 | #amplify 27 | amplify/\#current-cloud-backend 28 | amplify/.config/local-* 29 | amplify/logs 30 | amplify/mock-data 31 | amplify/backend/amplify-meta.json 32 | amplify/backend/awscloudformation 33 | amplify/backend/.temp 34 | build/ 35 | dist/ 36 | node_modules/ 37 | aws-exports.js 38 | awsconfiguration.json 39 | amplifyconfiguration.json 40 | amplify-build-config.json 41 | amplify-gradle-config.json 42 | amplifytools.xcconfig 43 | .secret-* -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "none", 3 | "tabWidth": 4, 4 | "semi": true, 5 | "singleQuote": true, 6 | "bracketSpacing": true, 7 | "jsxBracketSameLine": true, 8 | "arrowParens": "always" 9 | } 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # NgxCsvParser - v1.3.1 (01/06/2023) 2 | * Readme Updated 3 | 4 | # NgxCsvParser - v1.3.0 (01/06/2023) 5 | * New Features: 6 | * Angular version 16.X.X support added 7 | 8 | # NgxCsvParser - v1.2.2 (11/02/2023) 9 | * New Features: 10 | * Angular version 15.X.X support added 11 | 12 | # NgxCsvParser - v1.2.1 (11/02/2023) 13 | * New Features: 14 | * Angular version 15.X.X support added 15 | 16 | # NgxCsvParser - v1.2.0 (21/08/2022) 17 | * New Features: 18 | * Updated Angular version to 14.X.X 19 | 20 | # NgxCsvParser - v0.0.6 (01/08/2020) 21 | * New Features: 22 | * Fix undefined issue for the header 23 | 24 | # NgxCsvParser - v0.0.5 (27/07/2020) 25 | * New Features: 26 | * Compliance updated as per RFC 4180 27 | * RFC 4180 https://tools.ietf.org/html/rfc4180 28 | 29 | # NgxCsvParser - v0.0.4 (27/07/2020) 30 | * New Features: 31 | * Compliance added as per RFC 4180 32 | * RFC 4180 https://tools.ietf.org/html/rfc4180 33 | * Not CSV Files can have values containing (,) and other characters as per RFC 4180 34 | 35 | # NgxCsvParser - v0.0.3 (05/06/2020) 36 | * New Features: 37 | * Dependencies updated 38 | 39 | # NgxCsvParser - v0.0.2 (04/12/2019) 40 | * New Features: 41 | * README File updated 42 | 43 | # NgxCsvParser - v0.0.1 (04/12/2019) 44 | * New Features: 45 | * README File updated 46 | 47 | # NgxCsvParser - v0.0.0 (04/12/2019) 48 | * New Features: 49 | * CSV File parsing support for Angular Framework. Go through the README.md file for detailed features and documentation. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Tofiq Quadri 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NgxCsvParser 2 | 3 | * This is a CSV Parser library which will help you to parse a selected CSV File in your Angular Application. Currently working with Angular version 16.x.x+ as tested along with backward compatibility with previous Angular versions. 4 | 5 | * This library is in compliance to RFC 4180 6 | 7 | # Examples/Demo 8 | 9 | * A simple Example can be found under src/app directory of this repository. 10 | 11 | * Simply run `npm i` and then run the application using your preffered command. 12 | 13 | # Installation 14 | `npm i ngx-csv-parser` 15 | 16 | # API 17 | `import { NgxCsvParserModule } from 'ngx-csv-parser;` 18 | 19 | # Usage 20 | 21 | ```typescript 22 | import { BrowserModule } from '@angular/platform-browser'; 23 | import { NgModule } from '@angular/core'; 24 | import { NgxCsvParserModule } from 'ngx-csv-parser'; 25 | 26 | import { AppComponent } from './app.component'; 27 | 28 | @NgModule({ 29 | declarations: [ 30 | AppComponent 31 | ], 32 | imports: [ 33 | BrowserModule, 34 | NgxCsvParserModule 35 | ], 36 | providers: [], 37 | bootstrap: [AppComponent] 38 | }) 39 | export class AppModule { } 40 | ``` 41 | ## Sponsor this library on Patreon 🎅: 42 | - Patreon Tofiq Quadri ✔ 43 | 44 | # Configuration 45 | 46 | * The library has 2 configuration options. 47 | 48 | * header: true or false. This will allow you to make the first row of your CSV file act as the key for the result and the data from the remaining file as the value for those objects. 49 | 50 | * Example if the csv data is: 51 | 52 | * firstName,lastName 53 | * John,Doe 54 | 55 | * In case the header config is true the result will be: 56 | 57 | ```typescript 58 | [ 59 | { 60 | firstName: 'John', 61 | lastName: 'Doe' 62 | } 63 | ] 64 | ``` 65 | * In case header config is false the result will be: 66 | ```typescript 67 | [ 68 | ['firstName', 'lastName'], 69 | ['John', 'Doe'] 70 | ] 71 | ``` 72 | 73 | * delimiter: the marking factor which decides which symbol should be used to split the file. 74 | * Default delimiter is: `','` 75 | 76 | # Use the import NgxCsvParser in your component. 77 | 78 | ```typescript 79 | import { Component } from '@angular/core'; 80 | import { ViewChild } from '@angular/core'; 81 | import { NgxCsvParser } from 'ngx-csv-parser'; 82 | import { NgxCSVParserError } from 'ngx-csv-parser'; 83 | 84 | @Component({ 85 | selector: 'app-root', 86 | templateUrl: './app.component.html', 87 | styleUrls: ['./app.component.scss'] 88 | }) 89 | 90 | export class AppComponent { 91 | 92 | csvRecords: any[] = []; 93 | header = false; 94 | 95 | constructor(private ngxCsvParser: NgxCsvParser) { 96 | } 97 | 98 | @ViewChild('fileImportInput', { static: false }) fileImportInput: any; 99 | 100 | // Your applications input change listener for the CSV File 101 | fileChangeListener($event: any): void { 102 | 103 | // Select the files from the event 104 | const files = $event.srcElement.files; 105 | 106 | // Parse the file you want to select for the operation along with the configuration 107 | this.ngxCsvParser.parse(files[0], { header: this.header, delimiter: ',' }) 108 | .pipe().subscribe((result: Array) => { 109 | 110 | console.log('Result', result); 111 | this.csvRecords = result; 112 | }, (error: NgxCSVParserError) => { 113 | console.log('Error', error); 114 | }); 115 | 116 | } 117 | } 118 | ``` 119 | 120 | ## Running the example in local env 121 | 122 | * `npm i` 123 | * Run `ng serve` for a dev server and running the demo app. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 124 | * Sample CSV File will be provided in the example folder. 125 | 126 | ## Hiring for Remote Frontend or Full Stack Developer? 127 | 128 | * Contact for Premium Software Development/Designing Service: https://tofiqquadri.com 129 | 130 | ## Services 131 | 132 | * For web development and related services visit us at: https://developershive.com 133 | * Mail us at: contact@developershive.com 134 | 135 | ## Author 136 | 137 | * Name: Tofiq Quadri 138 | * Email: tofiqquadri@developershive.com 139 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "AngularCSVParser": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/AngularCSVParser", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "assets": [ 26 | "src/favicon.ico", 27 | "src/assets" 28 | ], 29 | "styles": [ 30 | "src/styles.scss" 31 | ], 32 | "scripts": [], 33 | "vendorChunk": true, 34 | "extractLicenses": false, 35 | "buildOptimizer": false, 36 | "sourceMap": true, 37 | "optimization": false, 38 | "namedChunks": true 39 | }, 40 | "configurations": { 41 | "production": { 42 | "fileReplacements": [ 43 | { 44 | "replace": "src/environments/environment.ts", 45 | "with": "src/environments/environment.prod.ts" 46 | } 47 | ], 48 | "optimization": true, 49 | "outputHashing": "all", 50 | "sourceMap": false, 51 | "namedChunks": false, 52 | "extractLicenses": true, 53 | "vendorChunk": false, 54 | "buildOptimizer": true, 55 | "budgets": [ 56 | { 57 | "type": "initial", 58 | "maximumWarning": "2mb", 59 | "maximumError": "5mb" 60 | }, 61 | { 62 | "type": "anyComponentStyle", 63 | "maximumWarning": "6kb" 64 | } 65 | ] 66 | } 67 | }, 68 | "defaultConfiguration": "" 69 | }, 70 | "serve": { 71 | "builder": "@angular-devkit/build-angular:dev-server", 72 | "options": { 73 | "browserTarget": "AngularCSVParser:build" 74 | }, 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "AngularCSVParser:build:production" 78 | } 79 | } 80 | }, 81 | "extract-i18n": { 82 | "builder": "@angular-devkit/build-angular:extract-i18n", 83 | "options": { 84 | "browserTarget": "AngularCSVParser:build" 85 | } 86 | }, 87 | "test": { 88 | "builder": "@angular-devkit/build-angular:karma", 89 | "options": { 90 | "main": "src/test.ts", 91 | "polyfills": "src/polyfills.ts", 92 | "tsConfig": "tsconfig.spec.json", 93 | "karmaConfig": "karma.conf.js", 94 | "assets": [ 95 | "src/favicon.ico", 96 | "src/assets" 97 | ], 98 | "styles": [ 99 | "src/styles.scss" 100 | ], 101 | "scripts": [] 102 | } 103 | }, 104 | "lint": { 105 | "builder": "@angular-devkit/build-angular:tslint", 106 | "options": { 107 | "tsConfig": [ 108 | "tsconfig.app.json", 109 | "tsconfig.spec.json", 110 | "e2e/tsconfig.json" 111 | ], 112 | "exclude": [ 113 | "**/node_modules/**" 114 | ] 115 | } 116 | }, 117 | "e2e": { 118 | "builder": "@angular-devkit/build-angular:protractor", 119 | "options": { 120 | "protractorConfig": "e2e/protractor.conf.js", 121 | "devServerTarget": "AngularCSVParser:serve" 122 | }, 123 | "configurations": { 124 | "production": { 125 | "devServerTarget": "AngularCSVParser:serve:production" 126 | } 127 | } 128 | } 129 | } 130 | }, 131 | "ngx-csv-parser": { 132 | "projectType": "library", 133 | "root": "projects/ngx-csv-parser", 134 | "sourceRoot": "projects/ngx-csv-parser/src", 135 | "prefix": "lib", 136 | "architect": { 137 | "build": { 138 | "builder": "@angular-devkit/build-angular:ng-packagr", 139 | "options": { 140 | "tsConfig": "projects/ngx-csv-parser/tsconfig.lib.json", 141 | "project": "projects/ngx-csv-parser/ng-package.json" 142 | } 143 | , "configurations": { 144 | "production": { 145 | "tsConfig": "projects/ngx-csv-parser/tsconfig.lib.prod.json" 146 | } 147 | } 148 | }, 149 | "test": { 150 | "builder": "@angular-devkit/build-angular:karma", 151 | "options": { 152 | "main": "projects/ngx-csv-parser/src/test.ts", 153 | "tsConfig": "projects/ngx-csv-parser/tsconfig.spec.json", 154 | "karmaConfig": "projects/ngx-csv-parser/karma.conf.js" 155 | } 156 | }, 157 | "lint": { 158 | "builder": "@angular-devkit/build-angular:tslint", 159 | "options": { 160 | "tsConfig": [ 161 | "projects/ngx-csv-parser/tsconfig.lib.json", 162 | "projects/ngx-csv-parser/tsconfig.spec.json" 163 | ], 164 | "exclude": [ 165 | "**/node_modules/**" 166 | ] 167 | } 168 | } 169 | } 170 | } 171 | } 172 | } -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | 'browserName': 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to AngularCSVParser!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('app-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es2018", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/Error test file.csvx: -------------------------------------------------------------------------------- 1 | firstName,lastName,email,phoneNumber,title,occupation 2 | Tofiq,Quadri,tofiq@ffd.com,9434343,SE,CEO 3 | sdsdfsdfsdfsdfgfg,Quadri,tofiq@ffd.com,9434343,SE,CEO 4 | -------------------------------------------------------------------------------- /example/Example # Delim.csv: -------------------------------------------------------------------------------- 1 | firstName#lastName#email#phoneNumber#title#occupation 2 | firstName#lastName#email#phoneNumber#title#occupation 3 | -------------------------------------------------------------------------------- /example/Example - RFC.csv: -------------------------------------------------------------------------------- 1 | product_id,product_name,product_description,product_price 2 | 12345,"1"" by 5 Yards Duct Tape","Great choice for your creative projects 3 | Super performance strength 4 | Available in white, red, green and black",9.95 -------------------------------------------------------------------------------- /example/Example RFC Complaint # Delim.csv: -------------------------------------------------------------------------------- 1 | "firstName"#lastName#email#phoneNumber#title#occupation 2 | "first#Name"#lastName#email#phoneNumber#title#occupation 3 | -------------------------------------------------------------------------------- /example/Example RFC Complaint.csv: -------------------------------------------------------------------------------- 1 | "firstName","lastName","email","phoneNumber","title","occupation" 2 | "Tofiq,Yes check complaint","Quadri","tofiq@ffd.com","9434343","SE","CEO" 3 | sdsdfsdfsdfsdfgfg,Quadri,"tofiq@ffd.com,gogle.com",9434343,SE,CEO 4 | -------------------------------------------------------------------------------- /example/Example.csv: -------------------------------------------------------------------------------- 1 | firstName,lastName,email,phoneNumber,title,occupation 2 | Tofiq,Quadri,tofiq@ffd.com,9434343,SE,CEO 3 | sdsdfsdfsdfsdfgfg,Quadri,tofiq@ffd.com,9434343,SE,CEO 4 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/AngularCSVParser'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-csvparser", 3 | "version": "1.3.1", 4 | "description": "CSV Import Library for Angular Framework. Go through the README.md file for detailed features and documentation.", 5 | "author": { 6 | "name": "Tofiq Quadri", 7 | "url": "https://linkedin.com/in/tofiqquadri", 8 | "email": "tofiqquadri@developershive.com" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/tofiqquadri/ngx-csv-parser.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/tofiqquadri/ngx-csv-parser/issues" 16 | }, 17 | "homepage": "https://github.com/tofiqquadri/ngx-csv-parser", 18 | "keywords": [ 19 | "angular csv import", 20 | "csv import", 21 | "ngx csv import", 22 | "angular", 23 | "csv", 24 | "import csv file in angular", 25 | "csv", 26 | "parser", 27 | "parse", 28 | "parsing", 29 | "delimited", 30 | "text", 31 | "data", 32 | "auto-detect", 33 | "comma", 34 | "tab", 35 | "pipe", 36 | "file", 37 | "filereader", 38 | "stream", 39 | "worker", 40 | "workers", 41 | "thread", 42 | "threading", 43 | "multi-threaded", 44 | "jquery-plugin" 45 | ], 46 | "license": "MIT", 47 | "scripts": { 48 | "ng": "ng", 49 | "start": "ng serve", 50 | "build": "ng build", 51 | "test": "ng test", 52 | "lint": "ng lint", 53 | "e2e": "ng e2e" 54 | }, 55 | "private": true, 56 | "dependencies": { 57 | "@angular/animations": "^16.0.3", 58 | "@angular/common": "^16.0.3", 59 | "@angular/compiler": "^16.0.3", 60 | "@angular/core": "^16.0.3", 61 | "@angular/forms": "^16.0.3", 62 | "@angular/platform-browser": "^16.0.3", 63 | "@angular/platform-browser-dynamic": "^16.0.3", 64 | "@angular/router": "^16.0.3", 65 | "rxjs": "^7.8.1", 66 | "zone.js": "~0.13.0" 67 | }, 68 | "devDependencies": { 69 | "@angular-devkit/build-angular": "*16.0.0", 70 | "@angular/cli": "*16.0.0", 71 | "@angular/compiler-cli": "*16.0.0", 72 | "@angular/language-service": "*16.0.0", 73 | "@types/jasmine": "~4.3.1", 74 | "@types/jasminewd2": "~2.0.10", 75 | "@types/node": "^20.1.0", 76 | "codelyzer": "^6.0.2", 77 | "jasmine-core": "~4.6.0", 78 | "jasmine-spec-reporter": "~7.0.0", 79 | "karma": "~6.4.2", 80 | "karma-chrome-launcher": "~3.2.0", 81 | "karma-coverage-istanbul-reporter": "~3.0.3", 82 | "karma-jasmine": "~5.1.0", 83 | "karma-jasmine-html-reporter": "^2.0.0", 84 | "ng-packagr": "^16.0.0", 85 | "protractor": "~7.0.0", 86 | "ts-node": "~10.9.1", 87 | "tslib": "^2.5.0", 88 | "tslint": "~6.1.0", 89 | "typescript": "~5.0.4" 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # NgxCsvParser - v1.3.1 (01/06/2023) 2 | * Readme Updated 3 | 4 | # NgxCsvParser - v1.3.0 (01/06/2023) 5 | * New Features: 6 | * Angular version 16.X.X support added 7 | 8 | # NgxCsvParser - v1.2.2 (11/02/2023) 9 | * New Features: 10 | * Angular version 15.X.X support added 11 | 12 | # NgxCsvParser - v1.2.1 (11/02/2023) 13 | * New Features: 14 | * Angular version 15.X.X support added 15 | 16 | # NgxCsvParser - v1.2.0 (21/08/2022) 17 | * New Features: 18 | * Encoding type selection added 19 | * Empty CSV File error resolved 20 | * Angular version 14.X.X support added 21 | 22 | # NgxCsvParser - v1.1.1 (21/03/2022) 23 | * New Features: 24 | * Type definitation not found issue fix 25 | 26 | # NgxCsvParser - v1.1.0 (20/03/2022) 27 | * New Features: 28 | * Updated Readme for usage 29 | 30 | # NgxCsvParser - v1.0.8 (20/03/2022) 31 | * New Features: 32 | * Update for types support 33 | 34 | # NgxCsvParser - v1.0.8 (20/03/2022) 35 | * New Features: 36 | * Peer dependency updated for Angular 13 37 | 38 | # NgxCsvParser - v0.0.7 (26/02/2021) 39 | * New Features: 40 | * Case insensitive check for csv file extension 41 | 42 | # NgxCsvParser - v0.0.6 (01/08/2020) 43 | * New Features: 44 | * Fix undefined issue for the header 45 | 46 | # NgxCsvParser - v0.0.5 (27/07/2020) 47 | * New Features: 48 | * Compliance updated as per RFC 4180 49 | * RFC 4180 https://tools.ietf.org/html/rfc4180 50 | 51 | # NgxCsvParser - v0.0.4 (27/07/2020) 52 | * New Features: 53 | * Compliance added as per RFC 4180 54 | * RFC 4180 https://tools.ietf.org/html/rfc4180 55 | * Not CSV Files can have values containing (,) and other characters as per RFC 4180 56 | 57 | # NgxCsvParser - v0.0.3 (05/06/2020) 58 | * New Features: 59 | * Dependencies updated 60 | 61 | # NgxCsvParser - v0.0.2 (04/12/2019) 62 | * New Features: 63 | * README File updated 64 | 65 | # NgxCsvParser - v0.0.1 (04/12/2019) 66 | * New Features: 67 | * README File updated 68 | 69 | # NgxCsvParser - v0.0.0 (04/12/2019) 70 | * New Features: 71 | * CSV File parsing support for Angular Framework. Go through the README.md file for detailed features and documentation. -------------------------------------------------------------------------------- /projects/ngx-csv-parser/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Tofiq Quadri 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/README.md: -------------------------------------------------------------------------------- 1 | # NgxCsvParser 2 | 3 | * This is a CSV Parser library which will help you to parse a selected CSV File in your Angular Application. Currently working with Angular version 16.x.x+ as tested along with backward compatibility with previous Angular versions. 4 | 5 | * This library is in compliance to RFC 4180 6 | 7 | # Examples/Demo 8 | 9 | * A simple Example can be found under src/app directory of this repository. 10 | 11 | * Simply run `npm i` and then run the application using your preffered command. 12 | 13 | # Installation 14 | `npm i ngx-csv-parser` 15 | 16 | # API 17 | `import { NgxCsvParserModule } from 'ngx-csv-parser;` 18 | 19 | # Usage 20 | 21 | ```typescript 22 | import { BrowserModule } from '@angular/platform-browser'; 23 | import { NgModule } from '@angular/core'; 24 | import { NgxCsvParserModule } from 'ngx-csv-parser'; 25 | 26 | import { AppComponent } from './app.component'; 27 | 28 | @NgModule({ 29 | declarations: [ 30 | AppComponent 31 | ], 32 | imports: [ 33 | BrowserModule, 34 | NgxCsvParserModule 35 | ], 36 | providers: [], 37 | bootstrap: [AppComponent] 38 | }) 39 | export class AppModule { } 40 | ``` 41 | 42 | # Configuration 43 | 44 | * The library has 3 configuration options. 45 | 46 | * header: true or false. This will allow you to make the first row of your CSV file act as the key for the result and the data from the remaining file as the value for those objects. 47 | 48 | * Example if the csv data is: 49 | 50 | * firstName,lastName 51 | * John,Doe 52 | 53 | * In case the header config is true the result will be: 54 | 55 | ```typescript 56 | [ 57 | { 58 | firstName: 'John', 59 | lastName: 'Doe' 60 | } 61 | ] 62 | ``` 63 | * In case header config is false the result will be: 64 | ```typescript 65 | [ 66 | ['firstName', 'lastName'], 67 | ['John', 'Doe'] 68 | ] 69 | ``` 70 | 71 | * delimiter: the marking factor which decides which symbol should be used to split the file. 72 | * Default delimiter is: `','` 73 | 74 | * encoding: this will define the encoding type to parse the csv file. You can select different encoding types depending on your file. 75 | * Default encoding type is: `'utf8'` 76 | 77 | # Use the import NgxCsvParser in your component. 78 | 79 | ## For ngx-csv-parser version 1.1.0 and above 80 | 81 | ```typescript 82 | import { Component, ViewChild } from '@angular/core'; 83 | import { NgxCsvParser, NgxCSVParserError } from 'ngx-csv-parser'; 84 | 85 | @Component({ 86 | selector: 'app-root', 87 | templateUrl: './app.component.html', 88 | styleUrls: ['./app.component.css'] 89 | }) 90 | export class AppComponent { 91 | csvRecords: any; 92 | header: boolean = false; 93 | 94 | constructor(private ngxCsvParser: NgxCsvParser) { 95 | } 96 | 97 | @ViewChild('fileImportInput') fileImportInput: any; 98 | 99 | fileChangeListener($event: any): void { 100 | 101 | const files = $event.srcElement.files; 102 | this.header = (this.header as unknown as string) === 'true' || this.header === true; 103 | 104 | this.ngxCsvParser.parse(files[0], { header: this.header, delimiter: ',', encoding: 'utf8' }) 105 | .pipe().subscribe({ 106 | next: (result): void => { 107 | console.log('Result', result); 108 | this.csvRecords = result; 109 | }, 110 | error: (error: NgxCSVParserError): void => { 111 | console.log('Error', error); 112 | } 113 | }); 114 | } 115 | } 116 | ``` 117 | 118 | ## For ngx-csv-parser version 0.0.7 and below 119 | 120 | ```typescript 121 | import { Component } from '@angular/core'; 122 | import { ViewChild } from '@angular/core'; 123 | import { NgxCsvParser } from 'ngx-csv-parser'; 124 | import { NgxCSVParserError } from 'ngx-csv-parser'; 125 | 126 | @Component({ 127 | selector: 'app-root', 128 | templateUrl: './app.component.html', 129 | styleUrls: ['./app.component.scss'] 130 | }) 131 | 132 | export class AppComponent { 133 | 134 | csvRecords: any[] = []; 135 | header = false; 136 | 137 | constructor(private ngxCsvParser: NgxCsvParser) { 138 | } 139 | 140 | @ViewChild('fileImportInput', { static: false }) fileImportInput: any; 141 | 142 | // Your applications input change listener for the CSV File 143 | fileChangeListener($event: any): void { 144 | 145 | // Select the files from the event 146 | const files = $event.srcElement.files; 147 | 148 | // Parse the file you want to select for the operation along with the configuration 149 | this.ngxCsvParser.parse(files[0], { header: this.header, delimiter: ',' }) 150 | .pipe().subscribe((result: Array) => { 151 | 152 | console.log('Result', result); 153 | this.csvRecords = result; 154 | }, (error: NgxCSVParserError) => { 155 | console.log('Error', error); 156 | }); 157 | 158 | } 159 | } 160 | ``` 161 | 162 | ## Running the example in local env 163 | 164 | * `npm i` 165 | * Run `ng serve` for a dev server and running the demo app. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 166 | * Sample CSV File will be provided in the example folder. 167 | 168 | ## Hiring for Remote Frontend or Full Stack Developer? 169 | 170 | * Contact for Premium Software Development/Designing Service: https://tofiqquadri.com 171 | 172 | ## Services 173 | 174 | * For web development and related services visit us at: https://developershive.com 175 | * Mail us at: contact@developershive.com 176 | 177 | ## Author 178 | 179 | * Name: Tofiq Quadri 180 | * Email: tofiqquadri@developershive.com -------------------------------------------------------------------------------- /projects/ngx-csv-parser/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/ngx-csv-parser'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/ngx-csv-parser", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /projects/ngx-csv-parser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngx-csv-parser", 3 | "version": "1.3.1", 4 | "description": "CSV Import Library for Angular Framework. Go through the README.md file for detailed features and documentation.", 5 | "author": { 6 | "name": "Tofiq Quadri", 7 | "url": "https://linkedin.com/in/tofiqquadri", 8 | "email": "tofiqquadri@developershive.com" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/tofiqquadri/ngx-csv-parser.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/tofiqquadri/ngx-csv-parser/issues" 16 | }, 17 | "homepage": "https://github.com/tofiqquadri/ngx-csv-parser", 18 | "keywords": [ 19 | "angular csv import", 20 | "csv import", 21 | "ngx csv import", 22 | "angular", 23 | "csv", 24 | "import csv file in angular", 25 | "csv", 26 | "parser", 27 | "parse", 28 | "parsing", 29 | "delimited", 30 | "text", 31 | "data", 32 | "auto-detect", 33 | "comma", 34 | "tab", 35 | "pipe", 36 | "file", 37 | "filereader", 38 | "stream", 39 | "worker", 40 | "workers", 41 | "thread", 42 | "threading", 43 | "multi-threaded", 44 | "jquery-plugin" 45 | ], 46 | "license": "MIT", 47 | "dependencies": { 48 | "tslib": "^2.5.0" 49 | }, 50 | "peerDependencies": { 51 | "@angular/common": ">=16.0.3", 52 | "@angular/core": ">=16.0.3" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/_model/ngx-csv-parser-config.interface.ts: -------------------------------------------------------------------------------- 1 | 2 | export class CSVParserConfig { 3 | header?: boolean; 4 | delimiter?: string; 5 | encoding?: 6 | 'utf8' 7 | | 'ibm866' 8 | | 'iso-8859-2' 9 | | 'iso-8859-3' 10 | | 'iso-8859-4' 11 | | 'iso-8859-5' 12 | | 'iso-8859-6' 13 | | 'iso-8859-7' 14 | | 'iso-8859-8' 15 | | 'iso-8859-8-i' 16 | | 'iso-8859-10' 17 | | 'iso-8859-13' 18 | | 'iso-8859-14' 19 | | 'iso-8859-15' 20 | | 'iso-8859-16' 21 | | 'koi8-r' 22 | | 'koi8-u' 23 | | 'macintosh' 24 | | 'windows-874' 25 | | 'windows-1250' 26 | | 'windows-1251' 27 | | 'windows-1252' 28 | | 'windows-1253' 29 | | 'windows-1254' 30 | | 'windows-1255' 31 | | 'windows-1256' 32 | | 'windows-1257' 33 | | 'windows-1258' 34 | | 'x-mac-cyrillic' 35 | | 'gbk' 36 | | 'gb18030' 37 | | 'big5' 38 | | 'euc-jp' 39 | | 'iso-2022-jp' 40 | | 'shift_jis' 41 | | 'euc-kr' 42 | | 'replacement' 43 | | 'utf-16be' 44 | | 'utf-16le' 45 | | 'x-user-defined'; 46 | 47 | constructor() {} 48 | } 49 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/_model/ngx-csv-parser-error.interface.ts: -------------------------------------------------------------------------------- 1 | export class NgxCSVParserError { 2 | type: string; // A generalization of the error 3 | code: number; // Standardized error code 4 | message: string; // Human-readable details 5 | } 6 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/ngx-csv-parser.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NgxCsvParserComponent } from './ngx-csv-parser.component'; 4 | 5 | describe('NgxCsvParserComponent', () => { 6 | let component: NgxCsvParserComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ NgxCsvParserComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NgxCsvParserComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/ngx-csv-parser.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'lib-ngx-csv-parser', 5 | template: ` 6 |

7 | ngx-csv-parser works! 8 |

9 | `, 10 | styles: [] 11 | }) 12 | export class NgxCsvParserComponent implements OnInit { 13 | 14 | constructor() { } 15 | 16 | ngOnInit() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/ngx-csv-parser.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { NgxCsvParserComponent } from './ngx-csv-parser.component'; 3 | import { NgxCsvParser } from './ngx-csv-parser.service'; 4 | 5 | @NgModule({ 6 | declarations: [NgxCsvParserComponent], 7 | imports: [ 8 | ], 9 | providers: [NgxCsvParser], 10 | exports: [NgxCsvParserComponent] 11 | }) 12 | export class NgxCsvParserModule { } 13 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/ngx-csv-parser.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { NgxCsvParser } from './ngx-csv-parser.service'; 4 | 5 | describe('NgxCsvParserService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: NgxCsvParser = TestBed.get(NgxCsvParser); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/lib/ngx-csv-parser.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Observable, Observer } from 'rxjs'; 3 | import { NgxCSVParserError } from './_model/ngx-csv-parser-error.interface'; 4 | import { CSVParserConfig } from './_model/ngx-csv-parser-config.interface'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class NgxCsvParser { 10 | private defaultCSVParserConfig: CSVParserConfig = { 11 | header: true, 12 | delimiter: ',', 13 | encoding: 'utf8' 14 | }; 15 | 16 | parse( 17 | csvFile: File, 18 | config: CSVParserConfig 19 | ): Observable | NgxCSVParserError> { 20 | config = { 21 | ...this.defaultCSVParserConfig, 22 | ...config 23 | }; 24 | 25 | const ngxCSVParserObserver = new Observable( 26 | (observer: Observer | NgxCSVParserError>) => { 27 | try { 28 | let csvRecords = null; 29 | 30 | if (this.isCSVFile(csvFile)) { 31 | const reader = new FileReader(); 32 | reader.readAsText(csvFile, config.encoding); 33 | 34 | reader.onload = () => { 35 | const csvData = (reader.result as string).trim(); 36 | if (csvData) { 37 | const csvRecordsArray = this.csvStringToArray( 38 | csvData, 39 | config.delimiter 40 | ); 41 | 42 | const headersRow = 43 | this.getHeaderArray(csvRecordsArray); 44 | 45 | csvRecords = 46 | this.getDataRecordsArrayFromCSVFile( 47 | csvRecordsArray, 48 | headersRow.length, 49 | config 50 | ); 51 | 52 | observer.next(csvRecords); 53 | } else { 54 | observer.next([]); 55 | } 56 | observer.complete(); 57 | }; 58 | 59 | reader.onerror = () => { 60 | this.badCSVDataFormatErrorHandler(observer); 61 | }; 62 | } else { 63 | this.notCSVFileErrorHandler(observer); 64 | } 65 | } catch (error) { 66 | this.unknownCSVParserErrorHandler(observer); 67 | } 68 | } 69 | ); 70 | 71 | return ngxCSVParserObserver; 72 | } 73 | 74 | csvStringToArray(csvDataString: string, delimiter: string) { 75 | const regexPattern = new RegExp( 76 | `(\\${delimiter}|\\r?\\n|\\r|^)(?:\"((?:\\\\.|\"\"|[^\\\\\"])*)\"|([^\\${delimiter}\"\\r\\n]*))`, 77 | 'gi' 78 | ); 79 | let matchedPatternArray = regexPattern.exec(csvDataString); 80 | const resultCSV = [[]]; 81 | while (matchedPatternArray) { 82 | if ( 83 | matchedPatternArray[1].length && 84 | matchedPatternArray[1] !== delimiter 85 | ) { 86 | resultCSV.push([]); 87 | } 88 | const cleanValue = matchedPatternArray[2] 89 | ? matchedPatternArray[2].replace( 90 | new RegExp('[\\\\"](.)', 'g'), 91 | '$1' 92 | ) 93 | : matchedPatternArray[3]; 94 | resultCSV[resultCSV.length - 1].push(cleanValue); 95 | matchedPatternArray = regexPattern.exec(csvDataString); 96 | } 97 | return resultCSV; 98 | } 99 | 100 | getDataRecordsArrayFromCSVFile( 101 | csvRecordsArray: any, 102 | headerLength: any, 103 | config: any 104 | ) { 105 | const dataArr = []; 106 | const headersArray = csvRecordsArray[0]; 107 | 108 | const startingRowToParseData = config.header ? 1 : 0; 109 | 110 | for (let i = startingRowToParseData; i < csvRecordsArray.length; i++) { 111 | const data = csvRecordsArray[i]; 112 | 113 | if (data.length === headerLength && config.header) { 114 | const csvRecord = {}; 115 | 116 | for (let j = 0; j < data.length; j++) { 117 | if (data[j] === undefined || data[j] === null) { 118 | csvRecord[headersArray[j]] = ''; 119 | } else { 120 | csvRecord[headersArray[j]] = data[j].trim(); 121 | } 122 | } 123 | dataArr.push(csvRecord); 124 | } else { 125 | dataArr.push(data); 126 | } 127 | } 128 | return dataArr; 129 | } 130 | 131 | isCSVFile(file: any) { 132 | return file.name.toLowerCase().endsWith('.csv'); 133 | } 134 | 135 | getHeaderArray(csvRecordsArr: any) { 136 | const headers = csvRecordsArr[0]; 137 | const headerArray = []; 138 | for (const header of headers) { 139 | headerArray.push(header); 140 | } 141 | return headerArray; 142 | } 143 | 144 | notCSVFileErrorHandler(observer: Observer) { 145 | const ngcCSVParserError: NgxCSVParserError = this.errorBuilder( 146 | 'NOT_A_CSV_FILE', 147 | 'Selected file is not a csv File Type.', 148 | 2 149 | ); 150 | observer.error(ngcCSVParserError); 151 | } 152 | 153 | unknownCSVParserErrorHandler(observer: Observer) { 154 | const ngcCSVParserError: NgxCSVParserError = this.errorBuilder( 155 | 'UNKNOWN_ERROR', 156 | 'Unknown error. Please refer to official documentation for library usage.', 157 | 404 158 | ); 159 | observer.error(ngcCSVParserError); 160 | } 161 | 162 | badCSVDataFormatErrorHandler(observer: Observer) { 163 | const ngcCSVParserError: NgxCSVParserError = this.errorBuilder( 164 | 'BAD_CSV_DATA_FORMAT', 165 | 'Unable to parse CSV File.', 166 | 1 167 | ); 168 | observer.error(ngcCSVParserError); 169 | } 170 | 171 | errorBuilder(type: string, message: any, code: any): NgxCSVParserError { 172 | const ngcCSVParserError: NgxCSVParserError = new NgxCSVParserError(); 173 | ngcCSVParserError.type = type; 174 | ngcCSVParserError.message = message; 175 | ngcCSVParserError.code = code; 176 | return ngcCSVParserError; 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of ngx-csv-parser 3 | */ 4 | 5 | export * from './lib/ngx-csv-parser.service'; 6 | export * from './lib/_model/ngx-csv-parser-error.interface'; 7 | export * from './lib/ngx-csv-parser.component'; 8 | export * from './lib/ngx-csv-parser.module'; 9 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js'; 4 | import 'zone.js/testing'; 5 | import { getTestBed } from '@angular/core/testing'; 6 | import { 7 | BrowserDynamicTestingModule, 8 | platformBrowserDynamicTesting 9 | } from '@angular/platform-browser-dynamic/testing'; 10 | 11 | // First, initialize the Angular testing environment. 12 | getTestBed().initTestEnvironment( 13 | BrowserDynamicTestingModule, 14 | platformBrowserDynamicTesting() 15 | ); 16 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/lib", 5 | "declarationMap": true, 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": [ 10 | "dom", 11 | "es2018" 12 | ] 13 | }, 14 | "angularCompilerOptions": { 15 | "skipTemplateCodegen": true, 16 | "strictMetadataEmit": true, 17 | "fullTemplateTypeCheck": true, 18 | "strictInjectionParameters": true, 19 | "enableResourceInlining": true, 20 | "compilationMode": "partial" 21 | }, 22 | "exclude": [ 23 | "src/test.ts", 24 | "**/*.spec.ts" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": true 5 | }, 6 | "angularCompilerOptions": { 7 | "enableIvy": false 8 | } 9 | } -------------------------------------------------------------------------------- /projects/ngx-csv-parser/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts" 12 | ], 13 | "include": [ 14 | "**/*.spec.ts", 15 | "**/*.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /projects/ngx-csv-parser/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "lib", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "lib", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

NgxCSVParser by Developers Hive

2 |
3 | 4 | 6 | 7 | 10 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 40 | 43 | 46 | 49 | 52 | 53 | 54 | 55 |
#First NameLast NameEmailPhone NumberTitleOccupation
{{i+1}} 35 | {{csvData.firstName}} 36 | 38 | {{csvData.lastName}} 39 | 41 | {{csvData.email}} 42 | 44 | {{csvData.phoneNumber}} 45 | 47 | {{csvData.title}} 48 | 50 | {{csvData.occupation}} 51 |
56 | 57 |
-------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .csv-file-chooser-section { 2 | padding: 10px; 3 | margin: 5%; 4 | border: 1px solid; 5 | text-align: center; 6 | } 7 | 8 | .csv-result-table { 9 | margin: 5%; 10 | border: 1px solid #73AD21; 11 | 12 | } 13 | 14 | table, th, td { 15 | border: 1px solid black; 16 | } -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async(() => { 6 | TestBed.configureTestingModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | }).compileComponents(); 11 | })); 12 | 13 | it('should create the app', () => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.debugElement.componentInstance; 16 | expect(app).toBeTruthy(); 17 | }); 18 | 19 | it(`should have as title 'AngularCSVParser'`, () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.debugElement.componentInstance; 22 | expect(app.title).toEqual('AngularCSVParser'); 23 | }); 24 | 25 | it('should render title in a h1 tag', () => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.debugElement.nativeElement; 29 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to AngularCSVParser!'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { ViewChild } from '@angular/core'; 3 | import { NgxCsvParser } from 'dist/ngx-csv-parser'; 4 | import { NgxCSVParserError } from 'dist/ngx-csv-parser'; 5 | 6 | @Component({ 7 | selector: 'app-root', 8 | templateUrl: './app.component.html', 9 | styleUrls: ['./app.component.scss'] 10 | }) 11 | export class AppComponent { 12 | csvRecords: any[] = []; 13 | header: boolean = false; 14 | 15 | constructor(private ngxCsvParser: NgxCsvParser) {} 16 | 17 | @ViewChild('fileImportInput') fileImportInput: any; 18 | 19 | fileChangeListener($event: any): void { 20 | const files = $event.srcElement.files; 21 | this.header = 22 | (this.header as unknown as string) === 'true' || 23 | this.header === true; 24 | 25 | this.ngxCsvParser 26 | .parse(files[0], { 27 | header: this.header, 28 | delimiter: ',', 29 | encoding: 'utf8' 30 | }) 31 | .pipe() 32 | .subscribe( 33 | (result: Array) => { 34 | console.log('Result', result); 35 | this.csvRecords = result; 36 | }, 37 | (error: NgxCSVParserError) => { 38 | console.log('Error', error); 39 | } 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | 5 | import { AppComponent } from './app.component'; 6 | 7 | import { NgxCsvParserModule } from 'projects/ngx-csv-parser/src/public-api'; 8 | 9 | @NgModule({ 10 | declarations: [ 11 | AppComponent 12 | ], 13 | imports: [ 14 | BrowserModule, 15 | FormsModule, 16 | NgxCsvParserModule 17 | ], 18 | providers: [], 19 | bootstrap: [AppComponent] 20 | }) 21 | export class AppModule { } 22 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tofiqquadri/ngx-csv-parser/fecd13828272be1c8ee355737a55bcd56e89a31b/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tofiqquadri/ngx-csv-parser/fecd13828272be1c8ee355737a55bcd56e89a31b/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularCSVParser 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | // First, initialize the Angular testing environment. 11 | getTestBed().initTestEnvironment( 12 | BrowserDynamicTestingModule, 13 | platformBrowserDynamicTesting() 14 | ); 15 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "es2020", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "ES2022", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ], 21 | "paths": { 22 | "ngx-csv-parser": [ 23 | "dist/ngx-csv-parser" 24 | ], 25 | "ngx-csv-parser/*": [ 26 | "dist/ngx-csv-parser/*" 27 | ] 28 | }, 29 | "useDefineForClassFields": false 30 | }, 31 | "angularCompilerOptions": { 32 | "fullTemplateTypeCheck": true, 33 | "strictInjectionParameters": true 34 | } 35 | } -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "align": { 5 | "options": [ 6 | "parameters", 7 | "statements" 8 | ] 9 | }, 10 | "array-type": false, 11 | "arrow-parens": false, 12 | "arrow-return-shorthand": true, 13 | "deprecation": { 14 | "severity": "warning" 15 | }, 16 | "component-class-suffix": true, 17 | "contextual-lifecycle": true, 18 | "curly": true, 19 | "directive-class-suffix": true, 20 | "directive-selector": [ 21 | true, 22 | "attribute", 23 | "app", 24 | "camelCase" 25 | ], 26 | "component-selector": [ 27 | true, 28 | "element", 29 | "app", 30 | "kebab-case" 31 | ], 32 | "eofline": true, 33 | "import-blacklist": [ 34 | true, 35 | "rxjs/Rx" 36 | ], 37 | "import-spacing": true, 38 | "indent": { 39 | "options": [ 40 | "spaces" 41 | ] 42 | }, 43 | "interface-name": false, 44 | "max-classes-per-file": false, 45 | "max-line-length": [ 46 | true, 47 | 140 48 | ], 49 | "member-access": false, 50 | "member-ordering": [ 51 | true, 52 | { 53 | "order": [ 54 | "static-field", 55 | "instance-field", 56 | "static-method", 57 | "instance-method" 58 | ] 59 | } 60 | ], 61 | "no-consecutive-blank-lines": false, 62 | "no-console": [ 63 | true, 64 | "debug", 65 | "info", 66 | "time", 67 | "timeEnd", 68 | "trace" 69 | ], 70 | "no-empty": false, 71 | "no-inferrable-types": [ 72 | true, 73 | "ignore-params" 74 | ], 75 | "no-non-null-assertion": true, 76 | "no-redundant-jsdoc": true, 77 | "no-switch-case-fall-through": true, 78 | "no-var-requires": false, 79 | "object-literal-key-quotes": [ 80 | true, 81 | "as-needed" 82 | ], 83 | "object-literal-sort-keys": false, 84 | "ordered-imports": false, 85 | "quotemark": [ 86 | true, 87 | "single" 88 | ], 89 | "trailing-comma": false, 90 | "no-conflicting-lifecycle": true, 91 | "no-host-metadata-property": true, 92 | "no-input-rename": true, 93 | "no-inputs-metadata-property": true, 94 | "no-output-native": true, 95 | "no-output-on-prefix": true, 96 | "no-output-rename": true, 97 | "semicolon": { 98 | "options": [ 99 | "always" 100 | ] 101 | }, 102 | "space-before-function-paren": { 103 | "options": { 104 | "anonymous": "never", 105 | "asyncArrow": "always", 106 | "constructor": "never", 107 | "method": "never", 108 | "named": "never" 109 | } 110 | }, 111 | "no-outputs-metadata-property": true, 112 | "template-banana-in-box": true, 113 | "template-no-negated-async": true, 114 | "typedef-whitespace": { 115 | "options": [ 116 | { 117 | "call-signature": "nospace", 118 | "index-signature": "nospace", 119 | "parameter": "nospace", 120 | "property-declaration": "nospace", 121 | "variable-declaration": "nospace" 122 | }, 123 | { 124 | "call-signature": "onespace", 125 | "index-signature": "onespace", 126 | "parameter": "onespace", 127 | "property-declaration": "onespace", 128 | "variable-declaration": "onespace" 129 | } 130 | ] 131 | }, 132 | "use-lifecycle-interface": true, 133 | "use-pipe-transform-interface": true, 134 | "variable-name": { 135 | "options": [ 136 | "ban-keywords", 137 | "check-format", 138 | "allow-pascal-case" 139 | ] 140 | }, 141 | "whitespace": { 142 | "options": [ 143 | "check-branch", 144 | "check-decl", 145 | "check-operator", 146 | "check-separator", 147 | "check-type", 148 | "check-typecast" 149 | ] 150 | } 151 | }, 152 | "rulesDirectory": [ 153 | "codelyzer" 154 | ] 155 | } --------------------------------------------------------------------------------