-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(general): fix build process for general consumption
+ Fix entrypoints for NPM distribution + Drop Laravel Mix in favour of tsc + Update README to reflect changes BREAKING CHANGE: Fix import for general consumption
- Loading branch information
1 parent
acf8bea
commit 173a53d
Showing
33 changed files
with
3,597 additions
and
3,660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var locale_1 = require("../types/locale"); | ||
var get_1 = __importDefault(require("lodash/get")); | ||
/** | ||
* Return selectedLocale from locales collection. | ||
* If selectedLocale is not found, it will return Locale.EN as fallback. | ||
* If both are not present, them it will throw an error | ||
* | ||
* @export | ||
* @template T | ||
* @param {LocaleObject<T>} locales | ||
* @param {Locale} [selectedLocale=Locale.EN] | ||
* @returns {T} | ||
*/ | ||
function getLocale(locales, selectedLocale) { | ||
if (selectedLocale === void 0) { selectedLocale = locale_1.Locale.EN; } | ||
var locale = get_1.default(locales, selectedLocale); | ||
if (locale === undefined) { | ||
locale = get_1.default(locales, locale_1.Locale.EN); | ||
} | ||
if (locale === undefined) { | ||
throw new Error("Cannot find locale " + selectedLocale + ", nor default fallback locale " + locale_1.Locale.EN); | ||
} | ||
return locale; | ||
} | ||
exports.default = getLocale; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var getLocale_1 = __importDefault(require("./getLocale")); | ||
var randomArrayElement_1 = __importDefault(require("./randomArrayElement")); | ||
var randomArrayElements_1 = __importDefault(require("./randomArrayElements")); | ||
var randomNumber_1 = __importDefault(require("./randomNumber")); | ||
exports.default = { getLocale: getLocale_1.default, randomArrayElement: randomArrayElement_1.default, randomArrayElements: randomArrayElements_1.default, randomNumber: randomNumber_1.default }; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var randomNumber_1 = __importDefault(require("./randomNumber")); | ||
/** | ||
* Return a random element from given array | ||
* | ||
* @export | ||
* @template T | ||
* @param {T[]} collection | ||
* @returns {T} | ||
*/ | ||
function randomArrayElement(collection) { | ||
var min = 0; | ||
var max = collection.length - 1; | ||
var index = randomNumber_1.default(min, max); | ||
return collection[index]; | ||
} | ||
exports.default = randomArrayElement; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var shuffle_1 = __importDefault(require("lodash/shuffle")); | ||
var take_1 = __importDefault(require("lodash/take")); | ||
/** | ||
* Return N random items from given array. | ||
* If the amount of items requested is greater than collection length, | ||
* it will return as many items as possible | ||
* | ||
* @export | ||
* @template T | ||
* @param {T[]} collection | ||
* @param {number} amount | ||
* @returns {T[]} | ||
*/ | ||
function randomArrayElements(collection, amount) { | ||
var shuffledCollection = shuffle_1.default(collection); | ||
return take_1.default(shuffledCollection, amount); | ||
} | ||
exports.default = randomArrayElements; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var random_1 = __importDefault(require("lodash/random")); | ||
/** | ||
* Return a random number between min and max values. | ||
* By default this function returns integers numbers, but can | ||
* return float if isFloating = true | ||
* | ||
* @export | ||
* @param {number} [min] | ||
* @param {number} [max] | ||
* @param {boolean} [isFloating=false] | ||
* @returns {number} | ||
*/ | ||
function randomNumber(min, max, isFloating) { | ||
if (isFloating === void 0) { isFloating = false; } | ||
if (min === undefined) { | ||
min = 0; | ||
} | ||
if (max === undefined) { | ||
max = min + 100; | ||
} | ||
return random_1.default(min, max, isFloating); | ||
} | ||
exports.default = randomNumber; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var helpers_1 = __importDefault(require("./helpers")); | ||
var name_1 = __importDefault(require("./name")); | ||
var faker = { helpers: helpers_1.default, name: name_1.default }; | ||
exports.default = faker; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var getLocale_1 = __importDefault(require("../../helpers/getLocale")); | ||
var locales_1 = __importDefault(require("./locales")); | ||
var randomArrayElement_1 = __importDefault(require("../../helpers/randomArrayElement")); | ||
/** | ||
* Return a random first name. | ||
* If a valid locale is given, it will the locale collection. | ||
* If the given locale is not valid, it will fallback to Locale.EN | ||
* | ||
* @export | ||
* @param {Locale} [selectedLocale] | ||
* @returns {string} | ||
*/ | ||
function firstName(selectedLocale) { | ||
var collection = getLocale_1.default(locales_1.default, selectedLocale); | ||
return randomArrayElement_1.default(collection); | ||
} | ||
exports.default = firstName; |
File renamed without changes.
Oops, something went wrong.