Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
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
}
symbols: false, // replace unicode symbols or not
remove: /[.]/g, // (optional) regex to remove characters
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.modes['rfc3986-non-unicode-with-dots'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.modes['rfc3986-non-unicode-with-dots-no-lower'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: false, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.mode = 'rfc3986-non-unicode';
function createSlug(textToSlugify, filenameMode = false, saveLowerChars = false) {
textToSlugify = transliterate(textToSlugify);
if(!filenameMode) {
if(saveLowerChars) {
slug.defaults.mode = 'rfc3986-non-unicode-with-dots-no-lower';
}
req.on("response", res => {
// Don't set up the pipe to the write stream unless the status is ok.
if (res.statusCode !== 200) {
return;
}
slug.defaults.mode = "rfc3986";
const secureFilename = `${new Date().getTime()}/${slug(objectName)}`;
// tslint:disable-next-line:no-console
const writeStream = bucket.file(secureFilename)
.createWriteStream({
// Tweak the config options as desired.
gzip: false,
public: true,
resumable: true,
metadata: {
contentType: res.headers["content-type"],
},
});
req.pipe(writeStream)
.on("finish", () => {
const bucketName = config.google.storage.bucket;
import jDataView from 'jdataview';
import { sprintf } from 'sprintf';
import { CMC7Parser } from './cmc7-parser';
import async from 'async';
import { CPF } from 'cpf_cnpj';
import { CNPJ } from 'cpf_cnpj';
import slug from 'slug';
slug.defaults.modes.pretty = {
replacement: ' ', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: false, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
slug.defaults.mode ='pretty';
const NON_NUMERIC = /[\D]/g;
const NON_WORD = /[\W]/g;
const ROW_SIZE = 502;
const BAN_VERSION = '02.7';
const MAX_THREADS = 2;
const CRLF = '\r\n';
import Sequelize, { type Transaction } from 'sequelize';
import removeMarkdown from '@tommoor/remove-markdown';
import isUUID from 'validator/lib/isUUID';
import { Collection, User } from '../models';
import { DataTypes, sequelize } from '../sequelize';
import parseTitle from '../../shared/utils/parseTitle';
import unescape from '../../shared/utils/unescape';
import Revision from './Revision';
const Op = Sequelize.Op;
const Markdown = new MarkdownSerializer();
const URL_REGEX = /^[a-zA-Z0-9-]*-([a-zA-Z0-9]{10,15})$/;
const DEFAULT_TITLE = 'Untitled';
slug.defaults.mode = 'rfc3986';
const slugify = text =>
slug(text, {
remove: /[.]/g,
});
const createRevision = (doc, options = {}) => {
// we don't create revisions for autosaves
if (options.autosave) return;
// we don't create revisions if identical to previous
if (doc.text === doc.previous('text')) return;
return Revision.create(
{
title: doc.title,
text: doc.text,
* Custom mode of rfc3986 without unicode symbols
*/
slug.defaults.modes['rfc3986-non-unicode'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
remove: /[.]/g, // (optional) regex to remove characters
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap, // replace multi-characters
}
slug.defaults.modes['rfc3986-non-unicode-with-dots'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap, // replace multi-characters
}
slug.defaults.modes['rfc3986-non-unicode-with-dots-no-lower'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: false, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap, // replace multi-characters
}
slug.defaults.mode = 'rfc3986-non-unicode'
/**
* Slugify 文本
* @param textToSlugify 待 slugify 的文本
regionCode?: string;
slug: string;
}
/**
* Helper class for retrieving locations by id or name
*/
export namespace LocationHelper {
const locationById: Map = new Map();
const locationBySlug: Map = new Map();
const slugOptions: {} = {
replacement: '-', // replace spaces with replacement
symbols: true, // replace unicode symbols or not
remove: /[.]/g, // (optional) regex to remove characters
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
// Add icon urls for all locations
const cdnUrl: string = 'https://raw.githubusercontent.com/weeco/clash-royale-assets/master/images';
// Load location object array into Map
countriesJson.forEach((location: IApiLocation) => {
const locationDetailed: ILocationDetails = {
...location,
iconUrls: {
large: `${cdnUrl}/clash-royale/locations/${location.countryCode}.png`
},
slug: slug(location.name, slugOptions)
};
locationById.set(location.id, locationDetailed);
slug: string;
}
/**
* Helper class for retrieving locations by id or name
*/
export namespace LocationHelper {
const locationById: Map = new Map();
const locationBySlug: Map = new Map();
const slugOptions: {} = {
replacement: '-', // replace spaces with replacement
symbols: true, // replace unicode symbols or not
remove: /[.]/g, // (optional) regex to remove characters
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap // replace multi-characters
};
// Add icon urls for all locations
const cdnUrl: string = 'https://raw.githubusercontent.com/weeco/clash-royale-assets/master/images';
// Load location object array into Map
countriesJson.forEach((location: IApiLocation) => {
const locationDetailed: ILocationDetails = {
...location,
iconUrls: {
large: `${cdnUrl}/clash-royale/locations/${location.countryCode}.png`
},
slug: slug(location.name, slugOptions)
};
locationById.set(location.id, locationDetailed);
locationBySlug.set(locationDetailed.slug, locationDetailed);
*/
slug.defaults.modes['rfc3986-non-unicode'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
remove: /[.]/g, // (optional) regex to remove characters
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap, // replace multi-characters
}
slug.defaults.modes['rfc3986-non-unicode-with-dots'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: true, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap, // replace multi-characters
}
slug.defaults.modes['rfc3986-non-unicode-with-dots-no-lower'] = {
replacement: '-', // replace spaces with replacement
symbols: false, // replace unicode symbols or not
lower: false, // result in lower case
charmap: slug.charmap, // replace special characters
multicharmap: slug.multicharmap, // replace multi-characters
}
slug.defaults.mode = 'rfc3986-non-unicode'
/**
* Slugify 文本
* @param textToSlugify 待 slugify 的文本
* @param filenameMode