Skip to content

simple substring entity,encode entity and decode entity

Notifications You must be signed in to change notification settings

lgc/intercept-entity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

intercept-entity

simple intercept,encode,decode entity

How to install

npm install intercept-entity

Usage

intercept

  • Param
intercept([String|Array|Object],[Number],[Number|does not exist],callback);
	example:
		intercept(obj,1,20,callback);
		intercept(obj,1,callback);
  • String
var entities = require("intercept-entity");

//String
entities.intercept('中abc国©üÿ',1,5,function (result) {
    console.log(result); //abc国
});
  • Array and Object
var entities = require("intercept-entity");

//Array
var obj ={first:'中国abc©üÿ',second:[{first:'a中国b©ücÿ'},{second:'中国©üabcÿ'}]};
entities.intercept(obj,3,function (result) {
    console.log(result); //{ first: 'bc©üÿ',second:[ { first: 'b©ücÿ' },{ second: 'üabcÿ' } ] }
});

encode

  • encode
var entities = require("intercept-entity");

entities.encode('Love中国'); //Love中国

decode

  • decode
var entities = require("intercept-entity");

entities.decode('Love中国'); //Love中国

About

simple substring entity,encode entity and decode entity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published