@teclone/utils
TypeScript icon, indicating that this package has built-in type declarations

2.26.1 • Public • Published

Utils

Build Status Coverage Status semantic-release npm version npm

Utils is a collection of utility methods for day to day web application and library development. It is developed for reusability purposes as it is utilized by most of all libraries published by same author.

If you bumped into this project and find it useful for your project, please don't hesitate to give us a star. Because it is a typescript project, you get excellent auto-completion and type checks.

Installation

npm install @teclone/utils

Usage Sample

import { scopeCallback, camelCase, copy, range, expandProperty } from '@teclone/utils';

console.log(camelCase('my-string')); //logs myString
console.log(camelCase('my:string', ':')); //logs myString

//copy objects without creating references
const myObject = {
  headers: {
    contentType: 'text/html',
  },
  colors: ['#fff', 'green', '#808080'],
};
const myObjectCopy = copy({}, myObject);

//changing headers does not change the copy
myObject.headers.contentType = 'text/css';
console.log(myObjectCopy.headers.contentType); //logs text/html

// expand property into a target object
const result = expandProperty({}, 'headers.contentType', 'text/css');
console.log(result.headers.contentType); // logs text/css

Package Sidebar

Install

npm i @teclone/utils

Weekly Downloads

44

Version

2.26.1

License

MIT

Unpacked Size

408 kB

Total Files

651

Last publish

Collaborators

  • teclone