Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raw_data.push({
name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
email: {fake('{{internet.email}}')},
location: (
{`${fake('{{address.city}}')}, `}
{fake('{{address.country}}')}
),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{commerce.price}}'),
phone: fake('{{phone.phoneNumber}}'),
version: fake('{{system.semver}}'),
});
}
export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
[setPagination]
);
const onChangePage = useCallback(
pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })),
[setPagination]
);
// ** Sorting config
raw_data.push({
name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
email: {fake('{{internet.email}}')},
location: (
{`${fake('{{address.city}}')}, `}
{fake('{{address.country}}')}
),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{commerce.price}}'),
phone: fake('{{phone.phoneNumber}}'),
version: fake('{{system.semver}}'),
});
}
export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
[setPagination]
);
const onChangePage = useCallback(
pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })),
[setPagination]
);
// ** Sorting config
for (let i = 1; i < 100; i++) {
raw_data.push({
name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
email: {fake('{{internet.email}}')},
location: (
{`${fake('{{address.city}}')}, `}
{fake('{{address.country}}')}
),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{commerce.price}}'),
phone: fake('{{phone.phoneNumber}}'),
version: fake('{{system.semver}}'),
});
}
export default () => {
// ** Pagination config
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
const onChangeItemsPerPage = useCallback(
pageSize => setPagination(pagination => ({ ...pagination, pageSize })),
[setPagination]
);
const onChangePage = useCallback(
pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })),
[setPagination]
);
let headers = ['id'].concat(fields).join(colSeparator) + os.EOL
fs.writeFile(mockFile, headers, {encoding: 'utf-8'}, (err) => {
if (err)
console.error(err)
})
let writeStream = fs.createWriteStream(mockFile, {flags : 'a'})
let rowCount = 0
let rowMod = numRows / 10
while (rowCount < numRows) {
let row : string = (rowCount + 1) + colSeparator
for (let field of fields) {
row += faker.fake(`{{name.${field}}}`) + colSeparator
}
row = row.substr(0, row.length - 1) + os.EOL
writeStream.write(row, 'utf-8')
rowCount++
if (rowCount % rowMod === 0)
console.info('written: ', rowCount, 'rows')
}
function arrayOfSpinners(count) {
let arr = []
let i = 0
while (i < count) {
arr.push(faker.fake('{{name.firstName}}'))
i++
}
return arr
}
describe("fake", () => {
faker.fake("mustacheTemplate");
});
Array.from(Array(10).keys(), order =>
Folks.insert({
name: fake('{{name.lastName}} {{name.firstName}}'),
order,
lastMod: (new Date()).valueOf(),
}),
);
function createTeachers(students) {
var teachers = [];
for ( var i = 0; i < faker.random.number(100) + 25; i++ ) {
var gender = ( faker.random.boolean() ) ? 'women' : 'men';
var teacher = {
id: faker.random.uuid(),
name: faker.fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
image: createPortraitImageUrl(gender),
likes: parseTeacherLikes(students)
};
teachers.push(teacher);
}
return teachers;
}
{
id: 'amount',
},
{
id: 'phone',
},
{
id: 'version',
},
];
const raw_data = [];
for (let i = 1; i < 100; i++) {
raw_data.push({
name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
email: {fake('{{internet.email}}')},
location: (
{`${fake('{{address.city}}')}, `}
{fake('{{address.country}}')}
),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{commerce.price}}'),
phone: fake('{{phone.phoneNumber}}'),
version: fake('{{system.semver}}'),
});
}
const generateUser = () => {
return {
uuid: Faker.random.uuid(),
firstName: fake('{{name.firstName}}'),
lastName: fake('{{name.lastName}}'),
dateOfBirth: fake('{{date.past}}')
};
}