GithubHelp home page GithubHelp logo

utils's Introduction

@untemps/utils

Utils for @untemps packages.


npm


Documentation

A complete documentation of utils is available here: Docs

Installation

yarn add @untemps/utils

utils's People

Contributors

untemps avatar semantic-release-bot avatar

Watchers

James Cloos avatar  avatar  avatar

utils's Issues

Polyfill `getBoundingClientRect` in `createElement`

In Jest context, getBoundingClientRect always returns 0 for all values which is pretty annoying when trying to test DOM element interactions.
If passing size and position in the createElement function, it may use these values to fill getBoundingClientRect returned object up.

Allow to pass direct string in resolveClassName function

resolveClassName accepts arrays as conditions only. In the case of a dynamic class names aggregation, it may be quite difficult to mix conditions and class names we want to set for sure : either we have to concatenate strings and resolveClassName results or we have to fake truthy conditions.

It would be great to be able to mix arrays of condition and strings in the array-single attribute of the function like this:

const a = 0
const b = 3
resolveClassName(['foo', [a < b, 'bar', 'gag'], 'pol', [a > 0, 'zaz']]) // 'foo bar pol'

Fix interpolate function

string/interpolate function is buggy since if we pass 0 as token value it is parsed as nullish value and the token key is returned.
Instead of converting the token value as a boolean ( !!value), we should check if it is not null or undefined.
That could be an idea to add a new lodash-like isNil function to evaluate this condition.

Change default to named exports

Functions are exported as default which leads to resolution failure in cjs environments, such as Jest. Switch to named exports should fix that.
That will be a breaking change.

Change rollup babel helpers bundling type

Rollup babel config sets babel-helpers = "bundled" which prevents the app using the package from resolving the helpers at runtime. Changing this value to "runtime" in combination with @babel/plugin-transform-runtime and @babel/runtime should fix this issue.

Write docs

Add jsdoc and comments to all utils and write README.

Add a getElement function

Add a function to retrieve a DOM element by its selector. A simple wrapper around the querySelector method to standardize the utils API.
Package: dom
Function name: getElement

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.