0.0.4 • Published 7 years ago

adawat v0.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

'Adawat is arabic and translates using google translate to Tools

A small library that brings essential tools that can be used in most web development projects, such as sorting, find, validation, etc.

Below are translations of the methods from English to Arabic(using Google translate for translation source): adawat = tools; farz = sort - quick sort method has been used; tajid = find - not yet released; sahih = true (this is used for validation - our end goal is too receive true) - functionality works, however no special cases developed; khatia = false - not yet released; manqi = filter = not yet released;

Installation

npm install adawat

Usage

var farz = require('adawat/farz');

var unsortedArray = [5, 2, 6, a, 1, 3, 4];
farz(unsortedArray);


Output: [a, 1, 2, 3, 4, 5, 6]; - this has been doing a quick sort method;

The Farz Method also supports an alphanumeric array - however method is not case insestive - coming soon.


var sahih = require('adawat/sahih');

var seed = [{
          name: 'Bruce',
          lastname: 'Wayne',
          alias: 'Batman'},{
          id: "002",
          name: 'Clark',
          alias: 'Superman'}];

sahih(seed,'nAme', 'bruce');

Output: "Key: name = Value: Bruce"  

The Sahih Method was created for validation purposes. If your checking if a larger array containing several thousand objects, this method will return the mathcing pair/s if exists within an array - empty array otherwise .

The Sahih Method is case insensitive.

var tajid = require('adawat/tajid');

tajid(seed, 'name', 'bruce');

Output: [[object Object] {
          alias: "Batman",
          lastname: "Wayne",
          name: "Bruce"
          }]

The tajid Method was created for validation purposes. If your checking if a larger array containing several thousand objects, this method will return the mathcing object if it exists - empty array otherwise.

The Tajid Method is not case sensitive - discovered issues with lowercase method during testing, working on resolution.

Tests

npm test

Contributing

Take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago