Git Product home page Git Product logo

utils's Introduction

E-Com Plus Utils

Publish CodeFactor npm version License MIT

JS utility functions to E-Com Plus (not only) related apps

CHANGELOG

Usage

The @ecomplus/utils package provides a list of methods, each one is a utility function related to e-commerce apps and E-Com Plus APIs and schemas.

It's available for both Node.js and browser environments, and can also be imported entirely or partially with ES modules.

import {
  i18n,
  formatMoney,
  minQuantity,
  price,
  // ...
} from '@ecomplus/utils'

i18n({ en_us: 'Hello', pt_br: 'Olá' })
// => 'Hello'
formatMoney(10)
// => $10.00

Development

Fork/clone this repository and install dependencies normally:

git clone https://github.com/ecomplus/utils
cd utils
npm i

Then you can edit source files and test locally with npm run serve.

Contributing

Please read the contribution guidelines.

Deploy

Take a look on package.json scripts:

  • npm run doc - Update jsdoc/docdash generated documentation;
  • npm run release - Generate changelog and new version;

utils's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

matheusgnreis

utils's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Change `config` to `_config`

Rename imported config object from config to _config and update the default values on methods documentation (jsdoc).
To explicitly reference the same object as did by other E-Com Plus related libs (eg.: ecomplus-client).

Add some parser methods

Add methods to parse:

  • Date string to { day, month, year };
  • Phone string to { country_code, number};
  • customer.name (or customer) object to full name string;

More?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/create-release.yml
  • actions/checkout v4
  • actions/create-release v1
.github/workflows/publish.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
npm
package.json
  • @babel/core ^7.24.4
  • @babel/preset-env ^7.24.4
  • @commitlint/cli ^17.8.1
  • @commitlint/config-conventional ^17.8.1
  • babel-loader ^8.3.0
  • copy-webpack-plugin ^6.4.1
  • core-js ^3.36.1
  • docdash ^2.0.2
  • husky ^4.3.8
  • jsdoc ^4.0.2
  • standard ^17.1.0
  • standard-version ^9.3.2
  • webpack ^4.47.0
  • webpack-cli ^3.3.12
  • webpack-dev-server ^3.11.3
  • core-js ^3.36.1
nvm
.nvmrc
  • node 16.20.2

  • Check this box to trigger a request for Renovate to run again on this repository

Documentation CI

Setup GH Actions workflow to generate documentation after push on master with edits to README.md or src/*.

Workflow steps should reproduce the same of following commands:

npm run doc
git add docs
git commit -m "docs(generate): update jsdoc/docdash generated documentation"
git push

Renomear métodos

🤔 BREAKING v2.0.0: Usar nomes mais descritivos e sempre (ou quase) iniciando com verbos (getAny, formatAny, listAny).

Em algumas situações fica muito ruim utilizar os métodos com pronomes genéricos como estão, tudo bem quando utilizado como ecomUtils.price por exemplo, mas como geralmente é feito named imports, só price parece um number, não uma função.

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.