Socket
Socket
Sign inDemoInstall

edge.js

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edge.js - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.nyc_output/151789ba697039d2f44ad8b2ae510c81.json

12

CHANGELOG.md

@@ -0,1 +1,13 @@

<a name="1.0.1"></a>
## [1.0.1](https://github.com/poppinss/edge/compare/v1.0.0...v1.0.1) (2017-06-21)
### Features
* **globals:** add globals ([7ddbb1e](https://github.com/poppinss/edge/commit/7ddbb1e))
* **tags:** export BaseTag to be extended by custom tags ([cfdfd04](https://github.com/poppinss/edge/commit/cfdfd04))
* **template:** edge.share now merges locals ([7402af4](https://github.com/poppinss/edge/commit/7402af4))
<a name="1.0.0"></a>

@@ -2,0 +14,0 @@ # 1.0.0 (2017-03-30)

1

index.js

@@ -14,1 +14,2 @@ 'use strict'

exports.BasePresenter = require('./src/Presenter')
exports.BaseTag = require('./src/Tags/BaseTag')

27

package.json
{
"name": "edge.js",
"version": "1.0.0",
"version": "1.0.1",
"description": "Node.js logical templating engine with fresh air",
"main": "index.js",
"scripts": {
"test:local": "npm run lint && node bin/tasks test:local",
"test:win": "npm run lint && node bin/tasks test:win",
"coverage": "npm run lint && node bin/tasks coverage",
"test": "npm run lint && node bin/tasks test",
"lint": "standard"
"lint": "standard",
"pretest": "npm run lint",
"posttest": "npm run coverage",
"test:local": "FORCE_COLOR=true node bin/index.js --local",
"test": "./node_modules/.bin/nyc npm run test:local",
"test:win": "set FORCE_COLOR=true && node bin/index.js --win",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},

@@ -21,10 +23,8 @@ "author": "amanvirk,adonisjs",

"dedent-js": "^1.0.1",
"istanbul": "^1.1.0-alpha.1",
"japa": "^1.0.1",
"node-req": "^1.0.5",
"require-all": "^2.2.0",
"japa-cli": "^1.0.1",
"node-req": "^2.0.1",
"nyc": "^11.0.2",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"standard": "^9.0.2",
"ygor": "^4.0.1",
"standard": "^10.0.2",
"zombie": "^5.0.5"

@@ -34,4 +34,5 @@ },

"debug": "^2.6.1",
"encodeurl": "^1.0.1",
"escape-html": "^1.0.3",
"esprima": "^3.1.3",
"esprima": "^4.0.0",
"indent-string": "^3.1.0",

@@ -38,0 +39,0 @@ "lodash": "^4.17.4",

@@ -13,3 +13,16 @@ 'use strict'

const _ = require('lodash')
const encodeurl = require('encodeurl')
/**
* Returns an array of numbers with in
* the defined range
*
* @method range
*
* @param {Number} [start = 0]
* @param {Number} end
* @param {Number} [step=1]
*
* @return {Array}
*/
const range = function (start, end) {

@@ -19,2 +32,20 @@ return _.range(start, end)

/**
* Converts an array into batch of multiple
* arrays.
*
* @method batch
*
* @param {Array} input
* @param {Number} size
*
* @return {Array}
*
* @example
* ```
* [1, 2, 3, 4]
* // returns
* [[1, 2], [3, 4]]
* ```
*/
const batch = function (input, size) {

@@ -24,2 +55,13 @@ return _.chunk(input, size)

/**
* Convert an object to JSON string via
* JSON.stringify
*
* @method toJSON
*
* @param {Object} input
* @param {Number} indent
*
* @return {String}
*/
const toJSON = function (input, indent = 2) {

@@ -29,2 +71,11 @@ return JSON.stringify(input, null, indent)

/**
* Returns the 1st item from an array
*
* @method first
*
* @param {Array} collection
*
* @return {Mixed}
*/
const first = function (collection) {

@@ -34,2 +85,11 @@ return _.first(collection)

/**
* Returns the last item from an array
*
* @method last
*
* @param {Array} collection
*
* @return {Mixed}
*/
const last = function (collection) {

@@ -39,2 +99,12 @@ return _.last(collection)

/**
* Groupby a collection with some field name
*
* @method groupBy
*
* @param {Array} collection
* @param {String|Number|Function} field
*
* @return {Array}
*/
const groupBy = function (collection, field) {

@@ -44,2 +114,12 @@ return _.groupBy(collection, field)

/**
* Returns the size of an element. Parsers
* arrays and strings
*
* @method size
*
* @param {Array|String} input
*
* @return {Number}
*/
const size = function (input) {

@@ -49,2 +129,150 @@ return _.size(input)

/**
* Returns an element by replacing dynamic values
* inside it. It is very simple to print an
* HTML string inside shorthand if statemnt.
*
* @method el
*
* @param {String} htmlStr
* @param {Object} hash
*
* @return {Object} - Instance of safe string
*
* @example
* ```
* this.el('<a href="$url"> $title </a>', { title: 'Docs', url: '/docs' })
* // returns
* // '<a href="/docs"> Docs </a>'
* ```
*/
const el = function (htmlStr, hash) {
return this.safe(htmlStr.replace(/\$([\w.-]+)/g, (match, group) => {
return _.get(hash, _.toPath(group))
}))
}
/**
* Convert a string to camelcase
*
* @method camelCase
*
* @param {String} input
*
* @return {String}
*/
const camelCase = function (input) {
return _.camelCase(input)
}
/**
* Capitalize a string.
*
* @method upperCase
*
* @param {String} input
*
* @return {String}
*/
const upperCase = function (input) {
return _.upperCase(input)
}
/**
* Lowercase a string.
*
* @method lowerCase
*
* @param {String} input
*
* @return {String}
*/
const lowerCase = function (input) {
return _.lowerCase(input)
}
/**
* Lowercase the first character in string.
*
* @method lowerFirst
*
* @param {String} input
*
* @return {String}
*/
const lowerFirst = function (input) {
return _.lowerFirst(input)
}
/**
* Upercase the first character in string.
*
* @method upperFirst
*
* @param {String} input
*
* @return {String}
*/
const upperFirst = function (input) {
return _.upperFirst(input)
}
/**
* Capitalize each first word of a string
*
* @method capitalize
*
* @param {String} input
*
* @return {String}
*/
const capitalize = function (input) {
return _.startCase(input)
}
/**
* Truncate a string to given number to characters
*
* @method truncate
*
* @param {String} input
* @param {Number} limitTo
* @param {String} [omission = ...]
*
* @return {String}
*/
const truncate = function (input, limitTo, omission) {
return _.truncate(input, {
length: limitTo,
omission: omission
})
}
/**
* Converts a plain url to an anchor tag
*
* @method toAnchor
*
* @param {String} url
* @param {Sting} title
*
* @return {Object} - Instance of safe object
*/
const toAnchor = function (url, title = url) {
return this.safe(`<a href="${url}"> ${title} </a>`)
}
/**
* Encodes a url
*
* @method urlEncode
*
* @param {String} url
*
* @return {String}
*/
const urlEncode = function (url) {
return encodeurl(url)
}
module.exports = {

@@ -57,3 +285,13 @@ range,

groupBy,
size
size,
el,
camelCase,
upperCase,
upperFirst,
lowerCase,
lowerFirst,
capitalize,
truncate,
toAnchor,
urlEncode
}

@@ -255,3 +255,3 @@ 'use strict'

share (locals) {
this._locals = locals
_.merge(this._locals, locals)
return this

@@ -258,0 +258,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc