@ansonhkg/utils
a personal utils library.
Last updated 3 months ago by ansonhkg .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ansonhkg/utils 
SYNC missed versions from official npm registry.

What is this?

A utils library for personal use.

Installation

npm

npm i @ansonhkg/utils --save

yarn

yarn add @ansonhkg/utils

Then ...

Usage

Array

Cusum

import utils from '@ansonhkg/utils';

var input = [1,2,3,4,5];

var output = utils.array.cusum(input);

// expected output: [1,3,6,10,15]

Image

Save Div as Image

<!-- target div -->
<div id="divId"></div>
import utils from '@ansonhkg/utils';

utils.image.saveDiv("divId", 'filename');

math

Add commas to digit

import utils from '@ansonhkg/utils';

var value = 1000000

var output = utils.math.commas(value);

// expected outcome 1,000,000

ui

Remove html tags from string

import utils from '@ansonhkg/utils';

var string = '<h1>food</h1>';

var new_string = utils.ul.html(string);

// expected outcome food

Dynamically changes a div height based on if div has touched footer

import utils from '@ansonhkg/utils';

  mounted() {
    this.$nextTick(() => {
      window.addEventListener('scroll', () => {
        if (window.innerWidth >= 1024) {
          utils.ul.dynamicDiv('header', 'targetDiv', 'footer')
        }
      })
    })
  }

Current Tags

  • 0.0.34                                ...           latest (3 months ago)

32 Versions

  • 0.0.34                                ...           3 months ago
  • 0.0.33                                ...           3 months ago
  • 0.0.32                                ...           4 months ago
  • 0.0.31                                ...           4 months ago
  • 0.0.30                                ...           4 months ago
  • 0.0.29                                ...           4 months ago
  • 0.0.28                                ...           4 months ago
  • 0.0.27                                ...           4 months ago
  • 0.0.26                                ...           4 months ago
  • 0.0.25                                ...           4 months ago
  • 0.0.23                                ...           4 months ago
  • 0.0.22                                ...           4 months ago
  • 0.0.19                                ...           4 months ago
  • 0.0.18                                ...           4 months ago
  • 0.0.17                                ...           4 months ago
  • 0.0.16                                ...           4 months ago
  • 0.0.15                                ...           4 months ago
  • 0.0.14                                ...           4 months ago
  • 0.0.13                                ...           4 months ago
  • 0.0.12                                ...           4 months ago
  • 0.0.11                                ...           4 months ago
  • 0.0.10                                ...           4 months ago
  • 0.0.9                                ...           4 months ago
  • 0.0.8                                ...           4 months ago
  • 0.0.7                                ...           4 months ago
  • 0.0.6                                ...           4 months ago
  • 0.0.5                                ...           4 months ago
  • 0.0.4                                ...           4 months ago
  • 0.0.3                                ...           4 months ago
  • 0.0.2                                ...           4 months ago
  • 0.0.1                                ...           4 months ago
  • 0.0.0                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 34
Last Day 0
Last Week 0
Last Month 67
Dependencies (363)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |