Coder Social home page Coder Social logo

gherciu / sagittarius Goto Github PK

View Code? Open in Web Editor NEW
41.0 0.0 1.0 2.43 MB

🎯 A set of javascript most used utils📑

Home Page: https://gherciu.github.io/sagittarius/

License: MIT License

JavaScript 49.68% TypeScript 44.60% CSS 5.72%
utils helpers sagittarius sagittarius-utils js-utils random isempty uniqueid tonumber debounce

sagittarius's Introduction

sagittarius

A set of javascript most used utils.

Site | Getting Started | API | Blog

GitHub Multipack

Getting started.

  • Install: npm i sagittarius-core
const { random, isEmpty } = require('sagittarius-core')
// Or install needed utils separately
// const random =  require('sagittarius-random')

// check if argument is empty
console.log(isEmpty({})) // true
// get a random nr
console.log(random(12, 21))

Or use via cdn:

<!--index.html-->
<script src="https://cdn.jsdelivr.net/npm/sagittarius-core@latest/build/index.js"></script>
<script>
  // check if argument is empty
  console.log(sagittarius.isEmpty({ a: 21 })) // false
  // get a random nr
  console.log(sagittarius.random(12, 21))
</script>

See more utils in description below

Data generation

  • random: Random number generation from range
  • uniqueId: Generates a unique ID. If prefix is given, the ID is appended to it.
  • range: Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. A step of -1 is used if a negative start is specified without an end or step. If end is not specified, it's set to start with start then set to 0.

Data validation

  • isEmpty: Check if provided argument is empty
  • has: Checks if path is a direct property of provided argument.

Data transformation

  • toNumber: Transform provided argument to number
  • toPath: Transform provided argument to a property path array

Data sorting

  • uniq: Filter and return uniq values from an array
  • get: Gets the value at path of provided argument. If the resolved value is undefined, the defaultValue is returned in its place.
  • difference: Compare 2 arguments and return the difference. The order and references of result values are determined by the first argument.

Data manipulation

  • debounce: Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked.
  • set: Sets the value at path of provided argument. If a portion of path doesn't exist, it's created. Return true or false if value is set with success.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Or you can sponsor via Open Collective

Open Collective

Author

@Gherciu/sagittarius © GHERCIU, Released under the MIT License.
Authored and maintained by GHERCIU with help from contributors (list).

If you like this repository star⭐ and watch👀 on GitHub

sagittarius's People

Contributors

gherciu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

shalim111

sagittarius's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.