How to use the faker.fake function in faker

To help you get started, we’ve selected a few faker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / eui / src-docs / src / views / datagrid / datagrid.js View on Github external
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
github elastic / eui / src-docs / src / views / datagrid / in_memory_enhancements.js View on Github external
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
github elastic / eui / src-docs / src / views / datagrid / datagrid.js View on Github external
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]
  );
github nilobarp / text2json / test / genTestData.ts View on Github external
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')
}
github codekirei / node-multispinner / test / utils / genSpinners.js View on Github external
function arrayOfSpinners(count) {
  let arr = []
  let i = 0
  while (i < count) {
    arr.push(faker.fake('{{name.firstName}}'))
    i++
  }
  return arr
}
github ssrwpo / ssr / demo / imports / api / Folks / server / fixtures.js View on Github external
Array.from(Array(10).keys(), order =>
    Folks.insert({
      name: fake('{{name.lastName}} {{name.firstName}}'),
      order,
      lastMod: (new Date()).valueOf(),
    }),
  );
github PabloHidalgo / angularjs-1.5-components-showcase / src / server / utils / data.js View on Github external
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;
}
github elastic / eui / src-docs / src / views / datagrid / in_memory_enhancements.js View on Github external
{
    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}}'),
  });
}
github chikeichan / redux-worker / demo / sortTable / reducers / users / users.js View on Github external
const generateUser = () => {
	return {
		uuid: Faker.random.uuid(),
		firstName: fake('{{name.firstName}}'),
		lastName: fake('{{name.lastName}}'),
		dateOfBirth: fake('{{date.past}}')
	};
}