Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Sketch already knows the layer it's going to apply to so we don't
// actually need the full layer
originalLayerName = item.override.affectedLayer.name;
}
let search = originalLayerName.split("|")[0];
let locale = originalLayerName.split("|")[1];
// Set up search string
let searchTerm = "{{" + search + "}}";
// Set up locale
if (locale) {
faker.locale = locale;
} else {
faker.locale = "en";
}
switch (type) {
case "fullName":
newLayerData = faker.name.findName();
break;
case "firstName":
newLayerData = faker.name.firstName();
break;
case "lastName":
newLayerData = faker.name.lastName();
break;
case "email":
newLayerData = faker.internet.email();
break;
case "phoneNumber":
import bcrypt from "bcryptjs";
import Faker from "faker";
import rimraf from "rimraf";
import path from "path";
import mkdirp from "mkdirp";
import posts from "./posts";
import { promisify } from "util";
import copydir from "copy-dir";
import generatePost from "./contentGenerator";
const mkdirpAsync = promisify(mkdirp);
const rimrafAsync = promisify(rimraf);
const copydirAsync = promisify(copydir);
Faker.locale = "en_US";
// All paths are relative to this file
const dataDir = "../../../data";
const publicUploadsDir = "../../public/uploads";
const uploadsSourceDir = "./uploads";
function absPath(p) {
return path.join(__dirname, p);
}
let models = null;
export const seed = async (dbModels, autoExit = true) => {
models = dbModels;
console.time("ensure data directories");
await Promise.all([
module['exports'] = function fakeData (hook) {
var faker = require('faker');
// supports multiple locales
faker.locale = 'en'; // try: 'de', 'es'
// supports all faker.js methods
var result = faker.name.findName();
hook.res.end(result);
};
import faker from 'faker'
import moment from 'moment'
import { getLocation, numbers } from '../lib/helpers'
faker.locale = 'es'
const { randomize } = faker.helpers
const vehicleBrands = require('./../fixtures/vehicle-brands.json')
const vehicleModels = require('./../fixtures/vehicle-models.json')
const Model = () => {
const vehicleName = randomize(vehicleBrands)
const vehicleBrand = randomize(vehicleModels[vehicleName])
const createdAt = faker.date.past()
const formmatedCreatedAt = moment(createdAt).format()
const updatedAt = faker.date.recent()
const formmatedUpdatedAt = moment(updatedAt).format()
const originPackage = {
coordinates: getLocation(),
address: {
city: faker.address.city(),
function buildFaker(str, lang) {
const faker = require('faker')
faker.locale = lang;
return faker.fake('{{' + str + '}}')
}
import React from 'react';
import ReactDataGrid from 'react-data-grid';
import { Editors, Toolbar, Formatters } from 'react-data-grid-addons';
import update from 'immutability-helper';
import faker from 'faker';
import exampleWrapper from '../components/exampleWrapper';
const { DropDownEditor } = Editors;
const { ImageFormatter } = Formatters;
faker.locale = 'en_GB';
const titles = ['Dr.', 'Mr.', 'Mrs.', 'Miss', 'Ms.'];
class Example extends React.Component {
constructor(props, context) {
super(props, context);
this._columns = [
{
key: 'id',
name: 'ID',
width: 80,
resizable: true
},
{
key: 'avartar',
name: 'Avartar',
const faker = require('faker');
const ReactDataGrid = require('react-data-grid');
const exampleWrapper = require('../components/exampleWrapper');
const React = require('react');
const {
ToolsPanel: { AdvancedToolbar: Toolbar, GroupedColumnsPanel },
Data: { Selectors },
Draggable: { Container: DraggableContainer },
Formatters: { ImageFormatter }
} = require('react-data-grid-addons');
import PropTypes from 'prop-types';
faker.locale = 'en_GB';
const createFakeRowObjectData = (index) => ({
id: 'id_' + index,
avartar: faker.image.avatar(),
county: faker.address.county(),
email: faker.internet.email(),
title: faker.name.prefix(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
street: faker.address.streetName(),
zipCode: faker.address.zipCode(),
date: faker.date.past().toLocaleDateString(),
bs: faker.company.bs(),
catchPhrase: faker.company.catchPhrase(),
companyName: faker.company.companyName(),
words: faker.lorem.words(),
function FakerPlugin (script, events) {
this.script = script;
this.events = events;
this.locale = this.script.config.plugins.faker.locale;
if (this.locale) {
faker.locale = this.locale;
debug('Locale set to', this.locale);
}
script.config.processor = script.config.processor || {};
script.config.processor.fakerPluginCreateVariables = fakerPluginCreateVariables;
script.scenarios.forEach(scenario => {
scenario.beforeRequest = scenario.beforeRequest || [];
scenario.beforeRequest.push('fakerPluginCreateVariables');
});
debug('Plugin initialized');
return this;
}
function configureFaker(config) {
const { locale = 'en' } = config
faker.locale = locale
}
export function fakeValue(type, options?, locale?) {
const fakeGenerator = fakeFunctions[type];
const argNames = fakeGenerator.args;
//TODO: add check
const callArgs = argNames.map(name => options[name]);
const localeBackup = faker.locale;
//faker.setLocale(locale || localeBackup);
faker.locale = locale || localeBackup;
const result = fakeGenerator.func(...callArgs);
//faker.setLocale(localeBackup);
faker.locale = localeBackup;
return result;
}