Nihilistic Party Mantra

    sagittarius-core
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.3 • Public • Published

    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

    Install

    npm i sagittarius-core

    DownloadsWeekly Downloads

    1

    Version

    1.3.3

    License

    MIT

    Unpacked Size

    32.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • gherciu_gheorghe