Skip to content

chore: move vendor to utils and update license notes #738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Faker - Copyright (c) 2022

This software consists of voluntary contributions made by many individuals.
This software consists of voluntary contributions made by many individuals.
For exact contribution history, see the revision history
available at https://github.com/faker-js/faker

Expand All @@ -23,7 +23,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

===
===

From: https://github.com/faker-js/faker/commit/a9f98046c7d5eeaabe12fc587024c06d683800b8
To: https://github.com/faker-js/faker/commit/29234378807c4141588861f69421bf20b5ac635e
Expand Down Expand Up @@ -58,4 +58,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion src/internet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Faker } from '.';
import * as random_ua from './vendor/user-agent';
import * as random_ua from './utils/user-agent';

/**
* Module to generate internet related entries.
Expand Down
2 changes: 1 addition & 1 deletion src/mersenne.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Gen from './vendor/mersenne';
import Gen from './utils/mersenne';

/**
* Module to generate seed based random numbers.
Expand Down
4 changes: 2 additions & 2 deletions src/unique.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RecordKey } from './vendor/unique';
import * as uniqueExec from './vendor/unique';
import type { RecordKey } from './utils/unique';
import * as uniqueExec from './utils/unique';

/**
* Module to generate unique entries.
Expand Down
9 changes: 9 additions & 0 deletions src/vendor/mersenne.ts → src/utils/mersenne.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// Copyright (c) 2022 Faker
//
// This is a version of the original source code migrated to TypeScript and modified by the Faker team.
// Check LICENSE for more details on copyright.
//
// ===
//
// this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class,
// an almost straight conversion from the original program, mt19937ar.c,
// translated by y. okada on July 17, 2006.
Expand All @@ -7,6 +14,8 @@
// lines commented with /* and */ are original comments.
// lines commented with // are additional comments in this JavaScript version.
// before using this version, create at least one instance of MersenneTwister19937 class, and initialize the each state, given below in c comments, of all the instances.
//
// ===

/*
* A C-program for MT19937, with initialization improved 2002/1/26.
Expand Down
File renamed without changes.
12 changes: 11 additions & 1 deletion src/vendor/user-agent.ts → src/utils/user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
/*
/**
* Copyright (c) 2022 Faker
*
* This is a version of the original code migrated to TypeScript and modified by the Faker team.
* Check LICENSE for more details about the copyright.
*
* ------------------------------------------------------------------------------------------------------------------------
*
* Copyright (c) 2012-2014 Jeffrey Mealo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
Expand Down Expand Up @@ -179,6 +186,9 @@ export function generate(faker: Faker): string {
]);
}

/**
*
*/
function randomBrowserAndOS(): Array<string | number> {
const browser = rnd({
chrome: 0.45132810566,
Expand Down