How to use the slug function in slug

To help you get started, we’ve selected a few slug 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 bipbop / harlan / src / plugins / lib / icheques / ban-factory.js View on Github external
let doc = this.company.cnpj || this.company.cpf;

        this.buffer.setString(0, '1');
        // CPF/CNPJ. de 2 a 15. 14.
        this.buffer.setString(1, doc.replace(NON_NUMERIC, '').substring(0, 14));
        // T:CPF/CNPJ. de 16 a 16. 1.
        this.buffer.setString(15, this.company.cnpj ? '1' : '2');
        // Nome do Cedente. de 17 a 56. 40.
        this.buffer.setString(16, slug((this.company.nome || this.company.responsavel)).replace(NON_WORD, ' ').substring(0, 40));
        // Endereco. de 57 a 96. 40.
        let endereco = [
            this.company.endereco[0],
            this.company.endereco[1],
            this.company.endereco[2]
        ].join(' ');
        this.buffer.setString(56, slug(endereco).substring(0, 40));
        // Cidade. de 97 a 114. 18.
        this.buffer.setString(96, slug(this.company.endereco[5]).substring(0, 18));
        // Estado. de 115 a 116. 2.
        this.buffer.setString(114, slug(this.company.endereco[6]).substring(0, 2));
        // CEP. de 117 a 124. 8.
        this.buffer.setString(116, this.company.endereco[4].replace(NON_NUMERIC, '').substring(0, 8));
        // Data de operação. de 180 a 185. 6.
        this.buffer.setString(179, moment().format('DDMMYY'));
        // Fator da operação. de 186 a 192. 7.
        this.buffer.setString(185, sprintf('%07d', 0));
        // Tx efetiva min. de 193 a 199. 7.
        this.buffer.setString(192, sprintf('%07d', 0));
        // Tx serviço. de 200 a 206. 7.
        this.buffer.setString(199, sprintf('%07d', 0));
        // Tx ISS. de 207 a 213. 7.
        this.buffer.setString(206, sprintf('%07d', 0));
github timwis / csv-schema / src / analyze.js View on Github external
export function analyzeRowResults (fieldsHash) {
  let fieldsArray = []
  for (let key in fieldsHash) {
    const field = fieldsHash[key]
    // Determine which field type wins
    field.type = determineWinner(field.typesFound)
    field.machineName = slug(key, {
      replacement: '_',
      lower: true
    })
    field.sourceName = key
    // If any null values encountered, set field nullable
    if (field.typesFound['null']) {
      field.nullable = true
    }
    fieldsArray.push(field)
  }
  return fieldsArray
}
github Human-Connection / Human-Connection / backend / src / seed / factories / users.js View on Github external
factory: async ({ args, neodeInstance }) => {
      const defaults = {
        id: uuid(),
        name: faker.name.findName(),
        email: faker.internet.email(),
        password: '1234',
        role: 'user',
        avatar: faker.internet.avatar(),
        about: faker.lorem.paragraph(),
        termsAndConditionsAgreedVersion: '0.0.1',
        termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z',
      }
      defaults.slug = slugify(defaults.name, { lower: true })
      args = {
        ...defaults,
        ...args,
      }
      args = await encryptPassword(args)
      const user = await neodeInstance.create('User', args)
      const email = await neodeInstance.create('EmailAddress', { email: args.email })
      await user.relateTo(email, 'primaryEmail')
      await email.relateTo(user, 'belongsTo')
      return user
    },
  }
github Eugeny / terminus / terminus-terminal / src / services / terminal.service.ts View on Github external
            profile = profiles.find(x => slug(x.name).toLowerCase() === this.config.store.terminal.profile) || profiles[0]
        }
github relax / relax / lib / components / title-slug.jsx View on Github external
onTitleChange (value) {
    var title = value;
    var slug = this.props.slug;

    if (!this.state.hasTypedSlug) {
      slug = slugify(title, {lower: true}).toLowerCase();
      this.validateSlugTimeout();
    }

    this.props.onChange({title, slug});
    this.setState({title, slug});
  }
github SAPConversationalAI / bot-connector / src / models / channel.js View on Github external
export const slugify = str => slug(str, { lower: true, replacement: '-' })
github anodyne / nova3 / nova / resources / js / Pages / Roles / Create.vue View on Github external
'form.display_name': function (newValue) {
            if (this.suggestName) {
                this.form.name = slug(newValue.toLowerCase());
            }
        },
        'permissions.search': {
github pdrummond / kaiser-prototype / src / data / State.js View on Github external
export function createReduxStore(boardKey) {
  boardKey = boardKey || 'default';
  boardKey = slug(boardKey);
  enhancer = composeWithDevTools(
    persistState(null, {
      key: 'kaiser/' + boardKey
    })
  );
  const initialState = (boardKey === 'default' ? sampleState : defaultState);
  initialState.board.title = boardKey;

  store = createStore(
    reducer,
    initialState,
    enhancer
  );
  return store;
}
github aaroncox / chainbb / services / frontend / src / actions / postActions.js View on Github external
export function generatePermlink(title, parent = null) {
  var permlink = '',
      date = new Date(),
      time = date.getFullYear().toString()+(date.getMonth()+1).toString()+date.getDate().toString()+"t"+date.getHours().toString()+date.getMinutes().toString()+date.getSeconds().toString()+date.getMilliseconds().toString()+"z"
  if(title && title.trim() !== '') {
    permlink = slug(title).toString()
  }
  if(parent) {
    permlink = "re-" + parent.author + "-" + parent.permlink + "-" + time;
  }
  if(permlink.length > 255) {
    permlink = permlink.substring(permlink.length - 255, permlink.length)
  }
  permlink = permlink.toLowerCase().replace(/[^a-z0-9-]+/g, '')
  return permlink;
}

slug

slugifies even utf-8 chars!

MIT
Latest version published 18 days ago

Package Health Score

86 / 100
Full package analysis