Skip to content

Commit

Permalink
feat: Add CJS version
Browse files Browse the repository at this point in the history
  • Loading branch information
Randagio13 committed Mar 22, 2022
1 parent 74ccf00 commit fa532a2
Show file tree
Hide file tree
Showing 11 changed files with 14,457 additions and 563 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/ban-ts-comment": 0
}
}
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Expand Up @@ -17,10 +17,10 @@ jobs:
node-version: 14
- name: Install dependencies
run: npm i
- name: Run specs
run: npm test
- name: Run package
run: npm run build
- name: Run specs
run: npm test
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Build
lib
37 changes: 1 addition & 36 deletions lib/cities.d.ts
@@ -1,36 +1 @@
export interface City {
id: number;
name: string;
state_id: number;
state_code: string;
country_id: number;
country_code: string;
latitude: string;
longitude: string;
}
declare type Cities = City[];
declare type Args = {
filters?: {
country_code?: never;
state_code?: never;
} | {
country_code: string | string[];
state_code?: string;
};
sort?: {
mode: 'asc';
key?: never;
} | {
mode: 'desc';
key?: never;
} | {
mode: 'alphabetical';
key: 'name';
};
};
export declare function getCities(args?: Args): Cities;
declare const _default: {
getCities: typeof getCities;
};
export default _default;
//# sourceMappingURL=cities.d.ts.map
export interface City{id:number;name:string;state_id:number;state_code:string;country_id:number;country_code:string;latitude:string;longitude:string;}declare type Cities=City[];declare type Args={filters?:{country_code?:never;state_code?:never;}|{country_code:string|string[];state_code?:string;};sort?:{mode:'asc';key?:never;}|{mode:'desc';key?:never;}|{mode:'alphabetical';key:'name';};};export declare function getCities(args?:Args):Cities;declare const _default:{getCities:typeof getCities;};export default _default;
5 changes: 1 addition & 4 deletions lib/index.d.ts
@@ -1,4 +1 @@
export { default as Cities } from './cities';
export type { City } from './cities';
export declare type SortType = 'alphabetical' | 'asc' | 'desc';
//# sourceMappingURL=index.d.ts.map
export{default as Cities}from'./cities';export type{City}from'./cities';export declare type SortType='alphabetical'|'asc'|'desc';
10 changes: 1 addition & 9 deletions lib/utils.d.ts
@@ -1,9 +1 @@
import { SortType } from './index';
export declare function dataFiltered<D, F extends keyof D>(data: D[], filters: Record<F, any>): D[];
declare type O = {
mode: SortType;
key?: any;
};
export declare function sorter<D, S extends O>(data: D[], options: S): D[];
export {};
//# sourceMappingURL=utils.d.ts.map
import{SortType}from'./index';export declare function dataFiltered<D,F extends keyof D>(data:D[],filters:Record<F,any>):D[];declare type O={mode:SortType;key?:any;};export declare function sorter<D,S extends O>(data:D[],options:S):D[];export{};

0 comments on commit fa532a2

Please sign in to comment.