Skip to content

Commit

Permalink
Export Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinNovak committed Oct 12, 2021
1 parent bbceed7 commit cab9f02
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { Linguini } from './linguini';
export { LangFile, CommonFile, CategoryItems, TypeMapper } from './models/internal-models';
export { join } from './utils/string-utils';
export * from './type-mappers';
export { Utils } from './utils';
export { TypeMappers } from './type-mappers';
2 changes: 1 addition & 1 deletion src/linguini.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import { CommonFile, LangFile, TypeMapper } from './models/internal-models';
import { DataUtils, FileUtils, RegexUtils } from './utils';
import { DataUtils, FileUtils, RegexUtils } from './utils/';

type LinguiniOptions = {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/type-mappers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URL } from 'url';
import { TypeMapper } from './models/internal-models';
import { StringUtils } from './utils';
import { StringUtils } from './utils/';

let stringTm: TypeMapper<string> = (jsonValue: any) => StringUtils.join(jsonValue, '\n');
let booleanTm: TypeMapper<boolean> = (jsonValue: any) => Boolean(jsonValue);
Expand Down
7 changes: 7 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { StringUtils } from './utils/';

export class Utils {
public static join(input: string | string[], separator: string): string {
return StringUtils.join(input, separator);
}
}
2 changes: 1 addition & 1 deletion src/utils/data-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StringUtils } from '.';
import { CategoryItems } from '../models/internal-models';
import { StringUtils } from './';

export class DataUtils {
public static replaceVariables(input: string, variables: { [name: string]: string }): string {
Expand Down
6 changes: 1 addition & 5 deletions src/utils/string-utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export class StringUtils {
public static join(input: string | string[], separator: string): string {
return join(input, separator);
return input instanceof Array ? input.join(separator) : input;
}
}

export function join(input: string | string[], separator: string): string {
return input instanceof Array ? input.join(separator) : input;
}
2 changes: 1 addition & 1 deletion tests/unit/utils/data-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { DataUtils } from '../../../src/utils';
import { DataUtils } from '../../../src/utils/';

describe('DataUtils', (): void => {
describe('#replaceVariablesInObj()', (): void => {
Expand Down

0 comments on commit cab9f02

Please sign in to comment.