1.0.0 • Published 8 years ago

vql v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

vql.js

a very quick javascript library for doing very quick stuff…

Build Status


vql is a small auxiliary library and a snappy, more performant replacement for many of javascript's slow native functions.

Install

$ npm install vql

Usage

var vql = require('vql');

API

vql.forEach

vql.forEach(array, callback, thisArg);

Iterates over an array, invoking callback for each element

Parameters
  1. array (Array): The array to iterate over
  2. callback (Function): The callback to invoke on each item. You can return false in the callback to break the loop.
  3. value (Any): The value of the current element
  4. index (Number): The current index
  5. array (Array): A reference to the array currently being iterated
  6. thisArg (Object): The context
vql.forEach([1, 2, 3, 4], function (value) {
  console.log(value);
});
// will console log 1, 2, 3, 4

vql.concat

vql.concat(firstList, secondList);

Concatenates two lists into a single one

Parameters
  1. firstList (Array): The first array
  2. secondList (Array): The second array
Returns

(Array): The concatenation of the two lists

vql.concat([1, 2, 3], [4, 5, 6]);
// => [1, 2, 3, 4, 5, 6]

vql.indexOf

vql.indexOf(array, value);

Return the first index of the element that matches the value. If not match was found return -1

Parameters
  1. array (Array): The array in which to find the first index of the value
  2. value (Any): The value to find the first index of.
Returns

(Number): The index of the first match OR -1

vql.indexOf(['yes', 'no', 'maybe'], 'maybe');
// => 2

vql.fill

vql.fill(array, value);

Returns a new array with same length but all element are a copy of value.

Parameters
  1. array (Array): The array to copy
  2. value (Any): The value to fill new array with
Returns

(Array): Array filled with value

vql.fill([1, 2, 3], 'waoaw');
// => ['waoaw', 'waoaw', 'waoaw']
1.0.0

8 years ago