Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async () => {
try {
const json = await jokeRequest;
const { joke } = JSON.parse(json).value;
const wrap = wordwrap(size.width - 10);
const wrapped = wrap(`Good work now enjoy this joke. You deserve it!\n\n${joke}\n\n` + //eslint-disable-line
chalk.grey('If you want to disable these jokes run: \n' +
'> ./node_modules/.bin/jira-precommit jokes disable'));
console.log(boxen(
wrapped,
{
padding: 1,
margin: 1
}
));
} catch (err) {} // eslint-disable-line
};
}
row.forEach(function (col, c) {
// leave room for left and right padding.
col.width = widths[c]
if (_this.wrap) wrapped = wrap.hard(_this._negatePadding(col))(col.text).split('\n')
else wrapped = col.text.split('\n')
// add top and bottom padding.
if (col.padding) {
for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
for (i = 0; i < (col.padding[bottom] || 0); i++) wrapped.push('')
}
wrapped.forEach(function (str, r) {
if (!rrows[r]) rrows.push([])
rrow = rrows[r]
for (var i = 0; i < c; i++) {
if (rrow[i] === undefined) rrow.push('')
}
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var read = require('read');
var wrap = require('wordwrap').hard(0, 75);
var util = require('util');
var Constants = require('./constants');
var userHome = require('user-home');
exports.camelcase = function (flag) {
return flag.split('-').reduce(function (str, word) {
return str + word[0].toUpperCase() + word.slice(1);
});
};
exports.ignoreCaseEquals = function (a, b) {
return a === b ||
(a !== null && a !== undefined &&
b !== null && b !== undefined &&
(a.toLowerCase() === b.toLowerCase())) === true;
};
export function stringifyDictionaryEntry(entry: WordType): string {
// let js-yaml handle dumping the word, just in case
let initialData = jsYaml.safeDump({word: entry.word}, {flowLevel: 4})
let definition = `definition: |
${wrap(2, 80)(entry.definition)}
`
return `${initialData}${definition}`
}
import * as fs from 'fs'
import * as handlebars from 'handlebars'
import * as moment from 'moment'
import * as path from 'path'
import * as wordwrap from 'wordwrap'
import * as S from 'sanctuary'
const testing = process.env.NODE_ENV === 'testing'
if (testing || process.env.COLOR === 'false') {
color.disable()
}
export const colors = color
const wrap = wordwrap.hard(0, 80)
function stripHandlebarsNewLine(str) {
return str.replace(/[\s\t\r\n](\{\{[#\/])/g, '$1')
}
export function debug(...args) {
if (!process.env.GH_VERBOSE) {
return
}
if (typeof args[0] === 'string') {
args[0] = `DEBUG: ${args[0]}`
console.log(...args)
return
}
lines () {
if (!this.text) return []
return wrap.hard(0, this.charactersPerLine)(this.text).split('\n')
}
}
async function _promptForAppleId({ appleId }: Options): Promise {
const wrap = wordwrap(process.stdout.columns || 80);
log(
wrap(
'Please enter your Apple Developer Program account credentials. ' +
'These credentials are needed to manage certificates, keys and provisioning profiles ' +
'in your Apple Developer account.'
)
);
log(wrap(chalk.bold('The password is only used to authenticate with Apple and never stored.')));
const { appleId: promptAppleId } = await prompt(
{
type: 'input',
name: 'appleId',
message: `Apple ID:`,
validate: nonEmptyInput,
async function _promptForAppleId({ appleId }) {
const wrap = wordwrap(process.stdout.columns || 80);
log(
wrap(
'Please enter your Apple Developer Program account credentials. ' +
'These credentials are needed to manage certificates, keys and provisioning profiles ' +
'in your Apple Developer account.'
)
);
log(wrap(chalk.bold('The password is only used to authenticate with Apple and never stored.')));
if (!appleId) {
({ appleId } = await prompt(
{
type: 'input',
name: 'appleId',
message: `Apple ID:`,
choices: FEATURED_TEMPLATES.map(template => {
if (typeof template === 'string') {
return prompt.separator(template);
} else {
return {
value: template.name,
name:
chalk.bold(padEnd(template.shortName, descriptionColumn)) +
trimStart(
wordwrap(
descriptionColumn + 2,
process.stdout.columns || 80
)(template.description)
),
short: template.name,
};
}
}),
},
constructor(scene, config, font, antique, emitter) {
this.emitter = emitter;
this.scene = scene;
this.font = font;
this.config = config;
this.wrap = wrap(CHAR_LIMIT);
this.buttons = {};
this.antique = antique;
this.messageGroup = new Group();
this.intersectedButton = null;
this.scene.add(this.messageGroup);
this.setMessage('waiting');
this.showMessage();
this.crazyGroup = new Group();
this.scene.add(this.crazyGroup);
this.buttons[config.rainbowText] = new Button(this.crazyGroup, this.font, config.rainbowText, 0, 2, this.emitter, 0.7 * 100, 0.2 * 100, 0.01 * 100, 0.04 * 100);
this.buttons[config.rainbowText].buttonGroup.position.z = 200;
this.buttons[config.rainbowText].buttonGroup.rotation.y = Math.PI;
}