Skip to content

Files

Latest commit

05ab55a · Apr 1, 2020

History

History

string

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 11, 2019
Nov 1, 2019
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Jun 29, 2019
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020
Apr 1, 2020

String


MIT License

String extensions

Table of contents

Usage

import { extend } from 'jsmodern';
import {
  capitalize,
  contains,
  firstIndex,
  firstItem,
  insert,
  isEmpty,
  isString,
  lastIndex,
  lastItem,
  len,
  lines,
  retain,
  splitWhitespace,
  toCamelCase,
  toKebabCase,
  toPascalCase,
  toSnakeCase,
  toStartCase,
} from 'jsmodern/dist/string.js';

extend({
  string: [
    capitalize,
    contains,
    firstIndex,
    firstItem,
    insert,
    isEmpty,
    isString,
    lastIndex,
    lastItem,
    len,
    lines,
    retain,
    splitWhitespace,
    toCamelCase,
    toKebabCase,
    toPascalCase,
    toSnakeCase,
    toStartCase,
  ],
});

console.log([
  String.prototype.capitalize,
  String.prototype.contains,
  String.prototype.firstIndex,
  String.prototype.firstItem,
  String.prototype.insert,
  String.prototype.isEmpty,
  String.isString,
  String.prototype.lastIndex,
  String.prototype.lastItem,
  String.prototype.len,
  String.prototype.lines,
  String.prototype.retain,
  String.prototype.splitWhitespace,
  String.prototype.toCamelCase,
  String.prototype.toKebabCase,
  String.prototype.toPascalCase,
  String.prototype.toSnakeCase,
  String.prototype.toStartCase,
].every(n => 'function' === typeof(n)));

Available extensions

Check out API Reference.

License

MIT License © Rong Sen Ng