How to use the underscored function from underscore.string

Find comprehensive JavaScript underscore.string.underscored code examples handpicked from public code repositorys.

55
56
57
58
59
60
61
62
63
64
65
66
/**
 * 将camelized 或者中划线转化成下划线
 * @param str 
 */
function underscored(str) {
    return _s.underscored(str);
}




/**
fork icon183
star icon970
watch icon0

+ 9 other calls in file

53
54
55
56
57
58
59
60
61
62
63
64
exports.classify = function(value, options, callback){
    callback(null, str.classify(String(value)));
};


exports.underscored = function(value, options, callback){
    callback(null, str.underscored(String(value)));
};


exports.dasherize = function(value, options, callback){
    callback(null, str.dasherize(String(value)));
fork icon2
star icon2
watch icon0

+ 2 other calls in file

55
56
57
58
59
60
61
62
63
64
  FIELD_NAMESPACE: this.props.project_namespace.replace(/(\/)/g, '\\'),
  FIELD_NAME: s.dasherize(this.props.project_name),
  FIELD_NAME_JS: s.classify(this.props.project_name).toLowerCase(),
  FIELD_NAME_PHP: field_name_php_camel_case,
  FIELD_NAME_CLASS_PHP: field_name_class_php,
  FIELD_NAME_PHP_PATH: 'CARBON_' + s.underscored(this.props.project_name).toUpperCase() + '_DIR',
  FIELD_NAME_COMPOSER: this.props.composer.replace('\\', '/'),
  FIELD_DESCRIPTION: s.clean(this.props.project_description),
  FIELD_NAME_SAMPLE: s.classify(field_name_php_camel_case).toLowerCase(),
}
fork icon1
star icon4
watch icon0

108
109
110
111
112
113
114
115
116
117
let actionPathParts = actionParts.join('/');
let statePath = configUtils.getChoiceByKey('path', 'store');
let actionPath = `${statePath.path}/${reducerRoot}/actions`;
let testPath = `${statePath.path}/${reducerRoot}/tests`;
let reducerPath = `${statePath.path}/${reducerRoot}/reducers`;
let constantName = _.underscored(actionName).toUpperCase();
let settings;
settings = {
  action: {
    path: `${actionPath}/${actionPathParts}/`,
fork icon0
star icon1
watch icon0

197
198
199
200
201
202
203
204
205
206
const u = use_underscore || false;

field = field.replace(/\//g, ' ').trim();

if (u) {
    return _s.underscored(field);
}
else {
    return _s.trim(_s.dasherize(field), '-');
}
fork icon0
star icon0
watch icon1

+ 5 other calls in file

38
39
40
41
42
43
44
45
46
47
 * @param columns
 * @returns {string}
 */
SqlConstructor.prototype.getInsertColumns = function (columns) {
    var _columns = _.map(columns, function (column) {
        return _s.underscored(column)
    });
    return '(' + _columns.join(',') + ')';
}

fork icon0
star icon0
watch icon7