Socket
Socket
Sign inDemoInstall

strings

Package Overview
Dependencies
4
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

8

lib/middleware/dates.js

@@ -22,3 +22,4 @@ /**

var format = function(d) {
var format = function(d, options) {
moment.lang(options.lang);
return function(f) {

@@ -32,5 +33,6 @@ return moment(d).format(f);

options = options || { slugify: false };
var slugify = ((typeof options.slugify !== 'undefined') && options.slugify === false) ? false : true;
var slugify = ((typeof options.slugify === 'undefined') || options.slugify === false) ? false : true;
options.lang = options.lang || 'en';
var formatter = format(d);
var formatter = format(d, options);

@@ -37,0 +39,0 @@ var datePatterns = {

{
"name": "strings",
"version": "0.1.3",
"version": "0.1.4",
"description": "Manipulate and rename strings using patterns, structures and presets.",

@@ -5,0 +5,0 @@ "main": "index.js",

{
"instrumentation": "node-jscoverage",
"sloc": 101,
"hits": 97,
"sloc": 103,
"hits": 99,
"misses": 4,
"coverage": 96.03960396039604,
"coverage": 96.11650485436894,
"files": [

@@ -128,5 +128,5 @@ {

"coverage": 100,
"hits": 16,
"hits": 18,
"misses": 0,
"sloc": 16,
"sloc": 18,
"source": {

@@ -218,286 +218,294 @@ "1": {

"22": {
"source": "var format = function(d) {",
"source": "var format = function(d, options) {",
"coverage": 1
},
"23": {
"source": " moment.lang(options.lang);",
"coverage": 1
},
"24": {
"source": " return function(f) {",
"coverage": 1
},
"24": {
"25": {
"source": " return moment(d).format(f);",
"coverage": 39
},
"25": {
"26": {
"source": " };",
"coverage": ""
},
"26": {
"27": {
"source": "};",
"coverage": ""
},
"27": {
"28": {
"source": "",
"coverage": ""
},
"28": {
"29": {
"source": "var dates = module.exports = function(d, options) {",
"coverage": 1
},
"29": {
"30": {
"source": "",
"coverage": ""
},
"30": {
"31": {
"source": " options = options || { slugify: false };",
"coverage": 1
},
"31": {
"source": " var slugify = ((typeof options.slugify !== 'undefined') && options.slugify === false) ? false : true;",
"32": {
"source": " var slugify = ((typeof options.slugify === 'undefined') || options.slugify === false) ? false : true;",
"coverage": 1
},
"32": {
"33": {
"source": " options.lang = options.lang || 'en';",
"coverage": 1
},
"34": {
"source": "",
"coverage": ""
},
"33": {
"source": " var formatter = format(d);",
"35": {
"source": " var formatter = format(d, options);",
"coverage": 1
},
"34": {
"36": {
"source": "",
"coverage": ""
},
"35": {
"37": {
"source": " var datePatterns = {",
"coverage": 1
},
"36": {
"38": {
"source": " // Full date",
"coverage": ""
},
"37": {
"39": {
"source": " 'date': new Pattern(/:\\bdate\\b/, slugified(formatter(\"YYYY/MM/DD\"), slugify)),",
"coverage": ""
},
"38": {
"40": {
"source": " // Long date formats",
"coverage": ""
},
"39": {
"41": {
"source": " 'L': new Pattern(/:\\bL\\b/, slugified(formatter(\"MM/DD/YYYY\"), slugify)),",
"coverage": ""
},
"40": {
"42": {
"source": " '1': new Pattern(/:\\b1\\b/, slugified(formatter(\"M/D/YYYY\"), slugify)),",
"coverage": ""
},
"41": {
"43": {
"source": " // Year (2013, 13)",
"coverage": ""
},
"42": {
"44": {
"source": " 'year': new Pattern(/:\\byear\\b/, slugified(formatter(\"YYYY\"), slugify)),",
"coverage": ""
},
"43": {
"45": {
"source": " 'YYYY': new Pattern(/:\\bYYYY\\b/, slugified(formatter(\"YYYY\"), slugify)),",
"coverage": ""
},
"44": {
"46": {
"source": " 'YY': new Pattern(/:\\bYY\\b/, slugified(formatter(\"YY\"), slugify)),",
"coverage": ""
},
"45": {
"47": {
"source": " // Month name (January, Jan)",
"coverage": ""
},
"46": {
"48": {
"source": " 'monthname': new Pattern(/:\\bmonthname\\b/,slugified(formatter(\"MMMM\"), slugify)),",
"coverage": ""
},
"47": {
"49": {
"source": " 'MMMM': new Pattern(/:\\bMMMM\\b/, slugified(formatter(\"MMMM\"), slugify)),",
"coverage": ""
},
"48": {
"50": {
"source": " 'MMM': new Pattern(/:\\bMMM\\b/, slugified(formatter(\"MMM\"), slugify)),",
"coverage": ""
},
"49": {
"51": {
"source": " // Month number (1, 01)",
"coverage": ""
},
"50": {
"52": {
"source": " 'month': new Pattern(/:\\bmonth\\b/, slugified(formatter(\"MM\"), slugify)),",
"coverage": ""
},
"51": {
"53": {
"source": " 'MM': new Pattern(/:\\bMM\\b/, slugified(formatter(\"MM\"), slugify)),",
"coverage": ""
},
"52": {
"54": {
"source": " 'mo': new Pattern(/:\\bmo\\b/, slugified(formatter(\"MM\"), slugify)),",
"coverage": ""
},
"53": {
"55": {
"source": " 'M': new Pattern(/:\\bM\\b/, slugified(formatter(\"M\"), slugify)),",
"coverage": ""
},
"54": {
"56": {
"source": " // Day of the year",
"coverage": ""
},
"55": {
"57": {
"source": " 'DDDD': new Pattern(/:\\bDDDD\\b/, slugified(formatter(\"DDDD\"), slugify)),",
"coverage": ""
},
"56": {
"58": {
"source": " 'DDD': new Pattern(/:\\bDDD\\b/, slugified(formatter(\"DDD\"), slugify)),",
"coverage": ""
},
"57": {
"59": {
"source": " // Day of the month",
"coverage": ""
},
"58": {
"60": {
"source": " 'day': new Pattern(/:\\bday\\b/, slugified(formatter(\"DD\"), slugify)),",
"coverage": ""
},
"59": {
"61": {
"source": " 'DD': new Pattern(/:\\bDD\\b/, slugified(formatter(\"DD\"), slugify)),",
"coverage": ""
},
"60": {
"62": {
"source": " 'D': new Pattern(/:\\bD\\b/, slugified(formatter(\"D\"), slugify)),",
"coverage": ""
},
"61": {
"63": {
"source": " // Day of the week (wednesday/wed)",
"coverage": ""
},
"62": {
"64": {
"source": " 'dddd': new Pattern(/:\\bdddd\\b/, slugified(formatter(\"dddd\"), slugify)),",
"coverage": ""
},
"63": {
"65": {
"source": " 'ddd': new Pattern(/:\\bddd\\b/, slugified(formatter(\"ddd\"), slugify)),",
"coverage": ""
},
"64": {
"66": {
"source": " 'dd': new Pattern(/:\\bdd\\b/, slugified(formatter(\"dd\"), slugify)),",
"coverage": ""
},
"65": {
"67": {
"source": " 'd': new Pattern(/:\\bd\\b/, slugified(formatter(\"d\"), slugify)),",
"coverage": ""
},
"66": {
"68": {
"source": " // Hour",
"coverage": ""
},
"67": {
"69": {
"source": " 'hour': new Pattern(/:\\bhour\\b/, slugified(formatter(\"HH\"), slugify)),",
"coverage": ""
},
"68": {
"70": {
"source": " 'HH': new Pattern(/:\\bHH\\b/, slugified(formatter(\"HH\"), slugify)),",
"coverage": ""
},
"69": {
"71": {
"source": " 'H': new Pattern(/:\\bH\\b/, slugified(formatter(\"H\"), slugify)),",
"coverage": ""
},
"70": {
"72": {
"source": " 'hh': new Pattern(/:\\bhh\\b/, slugified(formatter(\"hh\"), slugify)),",
"coverage": ""
},
"71": {
"73": {
"source": " 'h': new Pattern(/:\\bh\\b/, slugified(formatter(\"h\"), slugify)),",
"coverage": ""
},
"72": {
"74": {
"source": " // Minute",
"coverage": ""
},
"73": {
"75": {
"source": " 'minute': new Pattern(/:\\bminute\\b/, slugified(formatter(\"mm\"), slugify)),",
"coverage": ""
},
"74": {
"76": {
"source": " 'min': new Pattern(/:\\bmin\\b/, slugified(formatter(\"mm\"), slugify)),",
"coverage": ""
},
"75": {
"77": {
"source": " 'mm': new Pattern(/:\\bmm\\b/, slugified(formatter(\"mm\"), slugify)),",
"coverage": ""
},
"76": {
"78": {
"source": " 'm': new Pattern(/:\\bm\\b/, slugified(formatter(\"m\"), slugify)),",
"coverage": ""
},
"77": {
"79": {
"source": " // Second",
"coverage": ""
},
"78": {
"80": {
"source": " 'second': new Pattern(/:\\bsecond\\b/, slugified(formatter(\"ss\"), slugify)),",
"coverage": ""
},
"79": {
"81": {
"source": " 'sec': new Pattern(/:\\bsec\\b/, slugified(formatter(\"ss\"), slugify)),",
"coverage": ""
},
"80": {
"82": {
"source": " 'ss': new Pattern(/:\\bss\\b/, slugified(formatter(\"ss\"), slugify)),",
"coverage": ""
},
"81": {
"83": {
"source": " 's': new Pattern(/:\\bs\\b/, slugified(formatter(\"s\"), slugify)),",
"coverage": ""
},
"82": {
"84": {
"source": " // AM/PM, am/pm",
"coverage": ""
},
"83": {
"85": {
"source": " 'A': new Pattern(/:\\bA\\b/, slugified(formatter(\"A\"), slugify)),",
"coverage": ""
},
"84": {
"86": {
"source": " 'a': new Pattern(/:\\ba\\b/, slugified(formatter(\"a\"), slugify)),",
"coverage": ""
},
"85": {
"87": {
"source": " 'P': new Pattern(/:\\bP\\b/, slugified(formatter(\"P\"), slugify)),",
"coverage": ""
},
"86": {
"88": {
"source": " 'p': new Pattern(/:\\bp\\b/, slugified(formatter(\"p\"), slugify))",
"coverage": ""
},
"87": {
"89": {
"source": " };",
"coverage": ""
},
"88": {
"90": {
"source": "",
"coverage": ""
},
"89": {
"91": {
"source": "",
"coverage": ""
},
"90": {
"92": {
"source": " return function() {",
"coverage": 1
},
"91": {
"93": {
"source": " return datePatterns;",
"coverage": 40
},
"92": {
"94": {
"source": " };",
"coverage": ""
},
"93": {
"95": {
"source": "};",

@@ -1328,5 +1336,5 @@ "coverage": ""

"failures": 0,
"start": "2014-01-20T03:10:30.175Z",
"end": "2014-01-20T03:10:30.209Z",
"duration": 34
"start": "2014-01-20T03:29:11.227Z",
"end": "2014-01-20T03:29:11.263Z",
"duration": 36
},

@@ -1347,3 +1355,3 @@ "tests": [

"fullTitle": "middleware dates should replace :L",
"duration": 0
"duration": 1
},

@@ -1368,3 +1376,3 @@ {

"fullTitle": "middleware dates should replace :YY",
"duration": 0
"duration": 1
},

@@ -1374,3 +1382,3 @@ {

"fullTitle": "middleware dates should replace :monthname",
"duration": 0
"duration": 1
},

@@ -1385,3 +1393,3 @@ {

"fullTitle": "middleware dates should replace :MMM",
"duration": 1
"duration": 0
},

@@ -1411,3 +1419,3 @@ {

"fullTitle": "middleware dates should replace :DDDD",
"duration": 0
"duration": 1
},

@@ -1437,3 +1445,3 @@ {

"fullTitle": "middleware dates should replace :dddd",
"duration": 0
"duration": 1
},

@@ -1448,3 +1456,3 @@ {

"fullTitle": "middleware dates should replace :dd",
"duration": 1
"duration": 0
},

@@ -1459,3 +1467,3 @@ {

"fullTitle": "middleware dates should replace :hour",
"duration": 0
"duration": 5
},

@@ -1490,3 +1498,3 @@ {

"fullTitle": "middleware dates should replace :min",
"duration": 4
"duration": 0
},

@@ -1496,3 +1504,3 @@ {

"fullTitle": "middleware dates should replace :mm",
"duration": 1
"duration": 0
},

@@ -1507,3 +1515,3 @@ {

"fullTitle": "middleware dates should replace :second",
"duration": 0
"duration": 1
},

@@ -1538,3 +1546,3 @@ {

"fullTitle": "middleware dates should replace :P",
"duration": 0
"duration": 1
},

@@ -1569,3 +1577,3 @@ {

"fullTitle": "middleware paths-slugify should replace :basename and slugify",
"duration": 0
"duration": 1
},

@@ -1585,3 +1593,3 @@ {

"fullTitle": "middleware paths-slugify should replace :dir and slugify",
"duration": 1
"duration": 0
},

@@ -1591,3 +1599,3 @@ {

"fullTitle": "strings structure should save the structure",
"duration": 0
"duration": 1
},

@@ -1617,3 +1625,3 @@ {

"fullTitle": "strings middleware should add middleware with exclude",
"duration": 0
"duration": 1
},

@@ -1628,3 +1636,3 @@ {

"fullTitle": "strings middleware should build context from middleware with exclusions",
"duration": 1
"duration": 0
},

@@ -1669,3 +1677,3 @@ {

"fullTitle": "middleware urls-slugify should replace :protocol and slugify",
"duration": 0
"duration": 1
}

@@ -1688,3 +1696,3 @@ ],

"fullTitle": "middleware dates should replace :L",
"duration": 0
"duration": 1
},

@@ -1709,3 +1717,3 @@ {

"fullTitle": "middleware dates should replace :YY",
"duration": 0
"duration": 1
},

@@ -1715,3 +1723,3 @@ {

"fullTitle": "middleware dates should replace :monthname",
"duration": 0
"duration": 1
},

@@ -1726,3 +1734,3 @@ {

"fullTitle": "middleware dates should replace :MMM",
"duration": 1
"duration": 0
},

@@ -1752,3 +1760,3 @@ {

"fullTitle": "middleware dates should replace :DDDD",
"duration": 0
"duration": 1
},

@@ -1778,3 +1786,3 @@ {

"fullTitle": "middleware dates should replace :dddd",
"duration": 0
"duration": 1
},

@@ -1789,3 +1797,3 @@ {

"fullTitle": "middleware dates should replace :dd",
"duration": 1
"duration": 0
},

@@ -1800,3 +1808,3 @@ {

"fullTitle": "middleware dates should replace :hour",
"duration": 0
"duration": 5
},

@@ -1831,3 +1839,3 @@ {

"fullTitle": "middleware dates should replace :min",
"duration": 4
"duration": 0
},

@@ -1837,3 +1845,3 @@ {

"fullTitle": "middleware dates should replace :mm",
"duration": 1
"duration": 0
},

@@ -1848,3 +1856,3 @@ {

"fullTitle": "middleware dates should replace :second",
"duration": 0
"duration": 1
},

@@ -1879,3 +1887,3 @@ {

"fullTitle": "middleware dates should replace :P",
"duration": 0
"duration": 1
},

@@ -1910,3 +1918,3 @@ {

"fullTitle": "middleware paths-slugify should replace :basename and slugify",
"duration": 0
"duration": 1
},

@@ -1926,3 +1934,3 @@ {

"fullTitle": "middleware paths-slugify should replace :dir and slugify",
"duration": 1
"duration": 0
},

@@ -1932,3 +1940,3 @@ {

"fullTitle": "strings structure should save the structure",
"duration": 0
"duration": 1
},

@@ -1958,3 +1966,3 @@ {

"fullTitle": "strings middleware should add middleware with exclude",
"duration": 0
"duration": 1
},

@@ -1969,3 +1977,3 @@ {

"fullTitle": "strings middleware should build context from middleware with exclusions",
"duration": 1
"duration": 0
},

@@ -2010,5 +2018,5 @@ {

"fullTitle": "middleware urls-slugify should replace :protocol and slugify",
"duration": 0
"duration": 1
}
]
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc