Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

customs.js

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

customs.js - npm Package Compare versions

Comparing version
0.2.2
to
0.3.0
+5
build/nodefy.json
{
"paths": {
"utl": "utl.js/dist/common"
}
}
+2
-2
{
"name": "customs.js",
"version": "0.2.2",
"version": "0.3.0",
"dependencies": {
"assist.js": "~0.3.4"
"utl.js": "~0.1.0"
},

@@ -7,0 +7,0 @@ "ignore": [

{
"assist" : "/node_modules/assist.js/dist/amd",
"utl" : "/node_modules/utl.js/dist/amd",
"proclaim" : "/node_modules/proclaim/lib/proclaim",
"sinon" : "/node_modules/sinon/pkg/sinon"
}

@@ -8,4 +8,4 @@ /*!

define([
'assist/isEmpty',
'assist/tmpl'
'utl/isEmpty',
'utl/tmpl'
], function (isEmpty, tmpl) {

@@ -12,0 +12,0 @@

@@ -7,4 +7,4 @@ /*!

var isEmpty = require('assist/isEmpty');
var tmpl = require('assist/tmpl');
var isEmpty = require('utl.js/dist/common/isEmpty');
var tmpl = require('utl.js/dist/common/tmpl');

@@ -11,0 +11,0 @@

@@ -22,4 +22,4 @@ (function (root, factory) {

*/
var assistIsArray, assistIsEmpty, assistTmpl, utils, customs, _checks_, _exam_;
assistIsArray = function (value) {
var utlIsArray, utlIsEmpty, utlTmpl, utils, customs, _checks_, _exam_;
utlIsArray = function (value) {
return Object.prototype.toString.call(value) === '[object Array]';

@@ -32,3 +32,3 @@ };

*/
assistIsEmpty = function (isArray) {
utlIsEmpty = function (isArray) {
/* -----------------------------------------------------------------------------

@@ -62,3 +62,3 @@ * isEmpty

};
}(assistIsArray);
}(utlIsArray);
/*!

@@ -69,3 +69,3 @@ * tmpl.js

*/
assistTmpl = function (str, data) {
utlTmpl = function (str, data) {
return str.replace(/{([^{}]*)}/g, function (a, b) {

@@ -88,3 +88,3 @@ return typeof data[b] === 'string' ? data[b] : a;

};
}(assistIsEmpty, assistTmpl);
}(utlIsEmpty, utlTmpl);
/*!

@@ -100,16 +100,16 @@ * checks.js

var regExs = {
numeric: /^[0-9]+$/,
integer: /^\-?[0-9]+$/,
decimal: /^\-?[0-9]*\.?[0-9]+$/,
email: /^[a-zA-Z0-9.!#$%&'*+\-\/=?\^_`{|}~\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$/,
alpha: /^[a-z]+$/i,
alphaNumeric: /^[a-z0-9]+$/i,
alphaDash: /^[a-z0-9_\-]+$/i,
natural: /^[0-9]+$/i,
naturalNoZero: /^[1-9][0-9]*$/i,
ip: /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i,
base64: /[^a-zA-Z0-9\/\+=]/i,
numericDash: /^[\d\-\s]+$/,
url: /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
};
numeric: /^[0-9]+$/,
integer: /^\-?[0-9]+$/,
decimal: /^\-?[0-9]*\.?[0-9]+$/,
email: /^[a-zA-Z0-9.!#$%&'*+\-\/=?\^_`{|}~\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$/,
alpha: /^[a-z]+$/i,
alphaNumeric: /^[a-z0-9]+$/i,
alphaDash: /^[a-z0-9_\-]+$/i,
natural: /^[0-9]+$/i,
naturalNoZero: /^[1-9][0-9]*$/i,
ip: /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i,
base64: /[^a-zA-Z0-9\/\+=]/i,
numericDash: /^[\d\-\s]+$/,
url: /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%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------------------------------------------------------------

@@ -116,0 +116,0 @@ * Checks

@@ -5,3 +5,3 @@ {

"author": "Jarid Margolin <jarid@firstopinion.co>",
"version": "0.2.2",
"version": "0.3.0",
"homepage": "https://github.com/jaridmargolin/customs.js",

@@ -20,6 +20,6 @@ "repository": {

"dependencies": {
"assist.js": "~0.3.4"
"utl.js": "~0.1.0"
},
"devDependencies": {
"easy-build": "~0.0.2",
"easy-build": "~0.1.0",
"proclaim": "~2.0.0",

@@ -26,0 +26,0 @@ "sinon": "~1.10.1"

@@ -8,4 +8,4 @@ /*!

define([
'assist/isEmpty',
'assist/tmpl'
'utl/isEmpty',
'utl/tmpl'
], function (isEmpty, tmpl) {

@@ -12,0 +12,0 @@

@@ -9,5 +9,4 @@ /*!

'proclaim',
'sinon',
'customs/customs'
], function (assert, sinon, Customs) {
], function (assert, Customs) {

@@ -14,0 +13,0 @@

/*!
* test/utils.js
*
* Copyright (c) 2014
*/
define([
'proclaim',
'sinon',
'utils'
], function (assert, sinon, _) {
/* -----------------------------------------------------------------------------
* test
* ---------------------------------------------------------------------------*/
describe('utils.js', function () {
/* ---------------------------------------------------------------------------
* isEmpty
* -------------------------------------------------------------------------*/
describe('isEmpty', function () {
it('Should return false if object has a property', function () {
assert.isFalse(_.isEmpty({ 'prop': 'val' }));
});
it('Should return true if object has no properties', function () {
assert.isTrue(_.isEmpty({}));
});
});
/* ---------------------------------------------------------------------------
* tmpl
* -------------------------------------------------------------------------*/
describe('tmpl', function () {
it('Should replace bracketed num with corresponding array index', function () {
var str = '| {0} | {1} | {2} |';
var data = ['1', '2', '3'];
assert.equal(_.tmpl(str, data), '| 1 | 2 | 3 |');
});
});
});
});